[wxpython-users] Re: Catching Shutdown Events
Jesse Aldridge
jessealdridge at gmail.com
Tue May 27 11:22:47 PDT 2008
I tried binding the close event to the frame, but it still doesn't work. It
seems I'm not getting the close event when I shutdown. If I close the frame
normally by clicking the x button, it works.
import os
import wx
print wx.version()
class MyApp(wx.App):
def __init__(self):
wx.App.__init__(self)
self.Bind(wx.EVT_END_SESSION, self.on_end_session)
def on_end_session(self, e):
out =3D open(os.path.expanduser("~/Desktop/end_session_app.txt"), "=
w")
out.write("ended session from App")
out.close()
e.Skip()
app =3D MyApp()
frame =3D wx.Frame(None)
def on_end_session(e):
out =3D open(os.path.expanduser("~/Desktop/end_session_frame.txt"), "w")
out.write("ended session from Frame")
out.close()
e.Skip()
frame.Bind(wx.EVT_END_SESSION, on_end_session)
frame.Bind(wx.EVT_CLOSE, on_end_session)
frame.Show(True)
app.MainLoop()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200805=
27/98b50780/attachment.htm
More information about the wxpython-users
mailing list