[Tutor] Re: Tkinter - How to get multilple windows
Lee Harr
missive at hotmail.com
Thu Jan 1 17:53:08 EST 2004
from Tkinter import * # Interface to TK Widgets
#class which has the test button only
#oncliking the test button i need the
#One more window but here it is coming befo
class App(Frame):
global quitButton, master
def __init__(self, master=None):
Frame.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
self.createNewButton = Button(self, text="Create New
Window",
command=self.openNew)
self.createNewButton.grid()
self.quitButton = Button(self, text="Quit Application",
command=self.quit)
self.quitButton.grid()
def openNew(self):
self.app1 = App1(self)
#app1.mainloop()
#quit class
class App1(Toplevel):
def __init__(self, master=None):
Toplevel.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
textButton = Button(self, text="Close This Window",
command=self.destroy)
textButton.grid()
app = App() #instance of the Application
app.master.title("Sample program")
app.mainloop() #wait for the events
_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
More information about the Tutor
mailing list