In Python using tkinter
, what is the difference between root.destroy()
and root.quit()
when closing the root window?
Is one pr
root.quit()
causes mainloop to exit. The interpreter is still intact, as are all the widgets. If you call this function, you can have code that executes after the call to root.mainloop()
, and that code can interact with the widgets (for example, get a value from an entry widget).
Calling root.destroy() will destroy all the widgets and exit mainloop. Any code after the call to root.mainloop()
will run, but any attempt to access any widgets (for example, get a value from an entry widget) will fail because the widget no longer exists.