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?
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 callquit()
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."