PageRenderTime 394ms CodeModel.GetById 171ms app.highlight 4ms RepoModel.GetById 217ms app.codeStats 1ms

/Demo/tix/grid.py

http://unladen-swallow.googlecode.com/
Python | 28 lines | 21 code | 6 blank | 1 comment | 4 complexity | edc381de3aa77e380d91ba95320c715f MD5 | raw file
 1###
 2import Tix as tk
 3from pprint import pprint
 4
 5r= tk.Tk()
 6r.title("test")
 7
 8l=tk.Label(r, name="a_label")
 9l.pack()
10
11class 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
18g = MyGrid(r, name="a_grid",
19selectunit="cell")
20g.pack(fill=tk.BOTH)
21for x in xrange(5):
22    for y in xrange(5):
23        g.set(x,y,text=str((x,y)))
24
25c = tk.Button(r, text="Close", command=r.destroy)
26c.pack()
27
28tk.mainloop()