blob: 20a205048a1464a9330eb81c7cbeb1faccd6eefd [file] [log] [blame]
Guido van Rossum35820f71994-10-07 09:55:26 +00001from Tkinter import *
2
Tim Peters182b5ac2004-07-18 06:16:08 +00003# 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.
Guido van Rossum35820f71994-10-07 09:55:26 +00005
6class Test(Frame):
7 def printit(self):
Collin Winter6f2df4d2007-07-17 20:59:35 +00008 print("hi")
Guido van Rossum35820f71994-10-07 09:55:26 +00009
10 def createWidgets(self):
Tim Peters182b5ac2004-07-18 06:16:08 +000011 self.QUIT = Button(self, text='QUIT', foreground='red',
12 command=self.quit)
Guido van Rossum35820f71994-10-07 09:55:26 +000013
Tim Peters182b5ac2004-07-18 06:16:08 +000014 self.QUIT.pack(side=LEFT, fill=BOTH)
15
16 # a hello button
17 self.hi_there = Button(self, text='Hello',
18 command=self.printit)
19 self.hi_there.pack(side=LEFT)
Guido van Rossum35820f71994-10-07 09:55:26 +000020
21 def __init__(self, master=None):
Tim Peters182b5ac2004-07-18 06:16:08 +000022 Frame.__init__(self, master)
23 Pack.config(self)
24 self.createWidgets()
Guido van Rossum35820f71994-10-07 09:55:26 +000025
26test = Test()
27test.mainloop()