blob: d881abef65d5fb38e979027c7dc07a75a88f54e6 [file] [log] [blame]
Guido van Rossum35820f71994-10-07 09:55:26 +00001from Tkinter import *
2
3# this shows how to spawn off new windows at a button press
4
5class Test(Frame):
6 def printit(self):
7 print "hi"
8
9 def makeWindow(self):
10 fred = Toplevel()
11 fred.label = Label(fred, {'text': "Here's a new window",})
12 fred.label.pack()
13
14 def createWidgets(self):
15 self.QUIT = Button(self, {'text': 'QUIT',
16 'fg': 'red',
17 'command': self.quit})
18
19 self.QUIT.pack({'side': 'left', 'fill': 'both'})
20
21
22 # a hello button
23 self.hi_there = Button(self, {'text': 'Make a New Window',
24 'command' : self.makeWindow})
25 self.hi_there.pack({'side': 'left'})
26
27
28 def __init__(self, master=None):
29 Frame.__init__(self, master)
30 Pack.config(self)
31 self.createWidgets()
32
33test = Test()
34test.mainloop()