Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 1 | ### |
Benjamin Peterson | d6d63f5 | 2009-01-04 18:53:28 +0000 | [diff] [blame] | 2 | import tkinter.tix as tk |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 3 | from pprint import pprint |
| 4 | |
| 5 | r= tk.Tk() |
| 6 | r.title("test") |
| 7 | |
| 8 | l=tk.Label(r, name="a_label") |
| 9 | l.pack() |
| 10 | |
| 11 | class MyGrid(tk.Grid): |
| 12 | def __init__(self, *args, **kwargs): |
| 13 | kwargs['editnotify']= self.editnotify |
| 14 | tk.Grid.__init__(self, *args, **kwargs) |
| 15 | def editnotify(self, x, y): |
| 16 | return True |
| 17 | |
| 18 | g = MyGrid(r, name="a_grid", |
| 19 | selectunit="cell") |
| 20 | g.pack(fill=tk.BOTH) |
Guido van Rossum | 805365e | 2007-05-07 22:24:25 +0000 | [diff] [blame] | 21 | for x in range(5): |
| 22 | for y in range(5): |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 23 | g.set(x,y,text=str((x,y))) |
| 24 | |
| 25 | c = tk.Button(r, text="Close", command=r.destroy) |
| 26 | c.pack() |
| 27 | |
| 28 | tk.mainloop() |