What is the difference between root.destroy() and root.quit()?

Gary Willoughby picture Gary Willoughby · Feb 21, 2010 · Viewed 25.8k times · Source

In Python using tkinter, what is the difference between root.destroy() and root.quit() when closing the root window?

Is one prefered over the other? Does one release resources that the other doesn't?

Answer

ErikT picture ErikT · Feb 22, 2010

quit() stops the TCL interpreter. This is in most cases what you want, because your Tkinter-app will also stop. It can be a problem, if you e.g. call your app from idle. idle is itself a Tkinker-app, so if you call quit() in your app and the TCL interpreter gets terminated, idle will also terminate (or get confused ).

destroy() just terminates the mainloop and deletes all widgets. So it seems to be safer if you call your app from another Tkinter app, or if you have multiple mainloops."

taken from http://www.daniweb.com/forums/thread66698.html