blob: 8f9ad471cce1f680df9908972dbdf756f06502fb [file] [log] [blame]
Guido van Rossum35820f71994-10-07 09:55:26 +00001from Tkinter import *
2
3import sys
4sys.path.append("/users/mjc4y/projects/python/tkinter/utils")
5from TkinterUtils import *
6
7# this shows how to create a new window with a button in it that can create new windows
8
9
10class Test(Frame):
11 def makeWindow(self, *args):
12 fred = Toplevel()
13
14 fred.label = Canvas (fred, {"width" : "2i",
15 "height" : "2i"})
16
17 fred.label.create_line("0", "0", "2i", "2i")
18 fred.label.create_line("0", "2i", "2i", "0")
19 fred.label.pack()
20
21 centerWindow(fred, self.master)
22
23 def createWidgets(self):
24 self.QUIT = QuitButton(self)
25 self.QUIT.pack({'side': 'left', 'fill': 'both'})
26
27
28 self.makeWindow = Button(self, {'text': 'Make a New Window',
29 'width' : 50,
30 'height' : 20,
31 'command' : self.makeWindow})
32 self.makeWindow.pack({'side': 'left'})
33
34 def __init__(self, master=None):
35 Frame.__init__(self, master)
36 Pack.config(self)
37 self.createWidgets()
38
39test = Test()
40test.mainloop()