blob: 4519a72df49a38044548c812a7722bae8c30b318 [file] [log] [blame]
Guido van Rossum35820f71994-10-07 09:55:26 +00001from 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',
11 'fg': 'red',
12 'command': self.quit})
13
14 self.QUIT.pack({'side': 'left', 'fill': 'both'})
15
16
17 self.hi_there = Button(self, {'text': 'Hello',
18 'command' : self.printit})
19 self.hi_there.pack({'side': 'left'})
20
21 # note how Packer defaults to {'side': 'top'}
22
23 self.guy2 = Button(self, {'text': 'button 2'})
24 self.guy2.pack()
25
26 self.guy3 = Button(self, {'text': 'button 3'})
27 self.guy3.pack()
28
29 def __init__(self, master=None):
30 Frame.__init__(self, master)
31 Pack.config(self)
32 self.createWidgets()
33
34test = Test()
35test.mainloop()