473,462 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

what's the difference between mainloop and app.mainloop and root.mainloop?

Expand|Select|Wrap|Line Numbers
  1. #code1
  2. from Tkinter import *       
  3. class Application(Frame):     
  4.     def __init__(self, master=None):
  5.         Frame.__init__(self, master)   
  6.         self.grid()                    
  7.         self.createWidgets()
  8.  
  9.     def createWidgets(self):
  10.         self.quitButton = Button ( self, text='Quit',
  11.             command=self.quit )               
  12.         self.quitButton.grid()         
  13.  
  14. app = Application()
  15. app.master.title("Sample application") 
  16. app.mainloop()
  17.  
Expand|Select|Wrap|Line Numbers
  1. #code2
  2. from Tkinter import *       
  3. class Application(Frame):     
  4.     def __init__(self, master=None):
  5.         Frame.__init__(self, master)   
  6.         self.grid()                    
  7.         self.createWidgets()
  8.  
  9.     def createWidgets(self):
  10.         self.quitButton = Button ( self, text='Quit',
  11.             command=self.quit )               
  12.         self.quitButton.grid()         
  13.  
  14. app = Application()
  15. app.master.title("Sample application") 
  16. root=Tk()
  17. root.mainloop()
  18.  
Expand|Select|Wrap|Line Numbers
  1. #code3
  2. from Tkinter import *       
  3. class Application(Frame):     
  4.     def __init__(self, master=None):
  5.         Frame.__init__(self, master)   
  6.         self.grid()                    
  7.         self.createWidgets()
  8.  
  9.     def createWidgets(self):
  10.         self.quitButton = Button ( self, text='Quit',
  11.             command=self.quit )               
  12.         self.quitButton.grid()         
  13.  
  14. app = Application()
  15. app.master.title("Sample application") 
  16. mainloop()
  17.  

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??
Aug 24 '11 #1
0 1161

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: vishal | last post by:
hi vishal here. could anyone tell me what is difference between get-post and head-put method of passing data between diffrent different web pages thxs for help in advance..............
1
by: Newbee Adam | last post by:
1. what is difference between buil and delpoy? 2. If I am finished with a web app lets say. how do I compile it and what type of a file will it be? .dll, aspx,... 3. how do I bundle an...
83
by: rahul8143 | last post by:
hello, what is difference between sizeof("abcd") and strlen("abcd")? why both functions gives different output when applied to same string "abcd". I tried following example for that. #include...
3
by: Junyin.Wu | last post by:
what is difference between SqlTransaction and T-Sql(begin tran, commit tran, rollback tran) thanks.
2
kiss07
by: kiss07 | last post by:
Hi, Any body Send reply.. What is difference between datatype Time and TimeStamp? Regards, Kiss07
0
by: Alexander Vasilevsky | last post by:
Hi! What a difference PowerShell Cmdlet and PSCmelet? -- http://www.alvas.net - Audio tools for C# and VB.Net developers
2
by: rameshcse2005 | last post by:
hai this is Ramesh , What the difference is between CREATE PROC and CREATE PROCEDURE? i have a basic question, i googled this question, but i could't get exact answer. so i hope somebody...
9
by: jinendrashankar | last post by:
Hi All, Can any one have any idea about this issue what is Difference between structure and class in C++ Other then by default structure have public scope and class have private scope For...
3
by: ganesh22 | last post by:
What the difference between Synchronous and Asynchronous?
0
by: gaurav92K | last post by:
sir please give the best answer of what is difference in remote assistance and netmeeting.
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.