Is it necessary to call Tk() when writing a GUI app with Tkinter?

John Salerno johnjsal at gmail.com
Thu Mar 1 06:45:28 CET 2012


On Wednesday, February 29, 2012 11:40:45 PM UTC-6, Terry Reedy wrote:
> On 2/29/2012 11:41 PM, John Salerno wrote:
> 
> > window? If you only want the Windows "X" button to close the window,
> > then is it okay to leave out any call to destroy()?
> 
> Yes. You must leave it out.
> 
> > the latter, then where in the code do you put the call to destroy so
> > it won't conflict with the user closing the window with the X
> > button?
> 
> See my other post of a few minutes ago for an example that now works.
> 
> -- 
> Terry Jan Reedy

When you suggested I create the root frame explicitly, you mean create a Tk object explicitly, as in your example, and then pass that as an argument to the Frame instance?

What exactly is the purpose of doing that? Does Tk do some extra work that a simple call to Frame won't do?





More information about the Python-list mailing list