blob: 9e8ccf43e1d90b3acd119d8d6068a1905e2765e1 [file] [log] [blame]
Guido van Rossum35820f71994-10-07 09:55:26 +00001from Tkinter import *
2
3# note that there is no explicit call to start Tk.
4# Tkinter is smart enough to start the system if it's not already going.
5
6class Test(Frame):
7 def printit(self):
8 print "hi"
9
10 def createWidgets(self):
11 self.QUIT = Button(self, {'text': 'QUIT',
12 'fg': 'red',
13 'command': self.quit})
14
15 self.QUIT.pack({'side': 'left', 'fill': 'both'})
16
17
18 # a hello button
19 self.hi_there = Button(self, {'text': 'Hello',
20 'command' : self.printit})
21 self.hi_there.pack({'side': 'left'})
22
23
24 def __init__(self, master=None):
25 Frame.__init__(self, master)
26 Pack.config(self)
27 self.createWidgets()
28
29test = Test()
30test.mainloop()