I have some cleanup code that I would like to run before my application is
closed down. I have it implemented when the window is closed from my file
menu, but I don't know how to implement it when someone chooses the X in
the upper right corner of the window to close it (is there a name for
this?). Is there a way to catch that click and do perform some functions
before it closes the window?
--vicki
In Monday, December 22, 2003, 11:56:40 AM, Vicki wrote:
I have some cleanup code that I would like to run before my application is
closed down. I have it implemented when the window is closed from my file
menu, but I don't know how to implement it when someone chooses the X in
the upper right corner of the window to close it (is there a name for
this?). Is there a way to catch that click and do perform some functions
before it closes the window?
Bind the EVT_CLOSE event to the code you want to run before closing:
class MyApp:
def __init__(self):
...
EVT_CLOSE(self, self.OnClose)
def OnClose(self, evt):
# Run this before exiting.
...
-- tacao