Expand|Select|Wrap|Line Numbers
- #code1
- from Tkinter import *
- class Application(Frame):
- def __init__(self, master=None):
- Frame.__init__(self, master)
- self.grid()
- self.createWidgets()
- def createWidgets(self):
- self.quitButton = Button ( self, text='Quit',
- command=self.quit )
- self.quitButton.grid()
- app = Application()
- app.master.title("Sample application")
- app.mainloop()
Expand|Select|Wrap|Line Numbers
- #code2
- from Tkinter import *
- class Application(Frame):
- def __init__(self, master=None):
- Frame.__init__(self, master)
- self.grid()
- self.createWidgets()
- def createWidgets(self):
- self.quitButton = Button ( self, text='Quit',
- command=self.quit )
- self.quitButton.grid()
- app = Application()
- app.master.title("Sample application")
- root=Tk()
- root.mainloop()
Expand|Select|Wrap|Line Numbers
- #code3
- from Tkinter import *
- class Application(Frame):
- def __init__(self, master=None):
- Frame.__init__(self, master)
- self.grid()
- self.createWidgets()
- def createWidgets(self):
- self.quitButton = Button ( self, text='Quit',
- command=self.quit )
- self.quitButton.grid()
- app = Application()
- app.master.title("Sample application")
- mainloop()
what's the difference between mainloop and app.mainloop and root.mainloop?
do they have different meaning?
which one is right or the best in code1,code2,code3??