Appropriate way to quit Tkinter

Fredrik Lundh fredrik at pythonware.com
Thu Oct 12 14:55:37 EDT 2006


mzdude wrote:

> I've just started playing with Python. Installed 2.5 on Windows XP
> system. I'm working through some of the examples in Programming Python
> 3ed by Mark Lutz. Given the following example when the Quit All button
> action is assigned to root.quit the windows aren't dismissed or
> destroyed. The application appears to terminate, but the windows
> remain. When the action is assigned to root.destroy, the windows are
> closed. Questions:
> 1) Which way is preferred / correct?

quit() causes the mainloop() call to return.  if calling mainloop() is 
the last thing you do in your program, the program terminates.

destroy() destroys the given window.  if that's the last window, the 
mainloop() is terminated as well.

> 2) Is something wrong with 2.5? (I haven't tried older versions of
> python)

not that I can see.

> 3) Is there something wrong with my installation?

works for me.  are you perhaps running this under some kind of IDE that 
keeps the process running even after the program has terminated?

</F>




More information about the Python-list mailing list