Clean up right after mainloop() exits.
apalopohapa
2010-06-02 01:21:03
You can set up a binding that gets fired when the window is destroyed. Either bind to or add a protocol handler for WM_DELETE_WINDOW.
For example:
def callback():
# your cleanup code here
...
root.protocol("WM_DELETE_WINDOW", callback)