PageRenderTime 444ms CodeModel.GetById 190ms app.highlight 4ms RepoModel.GetById 248ms app.codeStats 0ms

/Demo/tkinter/matt/packer-simple.py

http://unladen-swallow.googlecode.com/
Python | 32 lines | 21 code | 9 blank | 2 comment | 0 complexity | 5d51b488796fee79f18dade9f7797a75 MD5 | raw file
 1from Tkinter import *
 2
 3
 4class Test(Frame):
 5    def printit(self):
 6        print self.hi_there["command"]
 7
 8    def createWidgets(self):
 9        # a hello button
10        self.QUIT = Button(self, text='QUIT', foreground='red',
11                           command=self.quit)
12        self.QUIT.pack(side=LEFT, fill=BOTH)
13
14        self.hi_there = Button(self, text='Hello',
15                               command=self.printit)
16        self.hi_there.pack(side=LEFT)
17
18        # note how Packer defaults to side=TOP
19
20        self.guy2 = Button(self, text='button 2')
21        self.guy2.pack()
22
23        self.guy3 = Button(self, text='button 3')
24        self.guy3.pack()
25
26    def __init__(self, master=None):
27        Frame.__init__(self, master)
28        Pack.config(self)
29        self.createWidgets()
30
31test = Test()
32test.mainloop()