When the user presses a close Button that I created, some tasks are performed before exiting. However, if the user clicks on the [X] button in the top-right of the window to close the window, I cannot perform these tasks.
How can I override what happens when the user clicks [X] button?
It sounds as if your save window should be modal.
If this is a basic save window, why are you reinventing the wheel?
Tkhas atkFileDialogfor this purpose.If what you want is to override the default behaviour of destroying the window, you can simply do:
This way, you can intercept the
destroy()call when someone closes the window (by any means) and do what you like.