Re: [wxPython] Hooking into the window destruction sequence
by Bernhard Herzog other posts by this author
May 6 2002 8:10PM messages near this date
Re: [wxPython] Hooking into the window destruction sequence
|
Re: [wxPython] Hooking into the window destruction sequence
"Robin Dunn" <robin@[...].com> writes:
> > I would like to hook some cleanup code into the window destruction
> > activities such that when a wxPanel-derived class is destroyed
> > (from whatever cause) the cleanup code is executed.
>
> EVT_WINDOW_DESTROY(self, self.OnCleanup)
If I understand this correctly, the following program should print
"on_destroy" when the window is closed:
from wxPython.wx import *
class MyFrame(wxFrame):
def __init__(self):
wxFrame.__init__(self, None, -1, "Destroy Event Test")
EVT_WINDOW_DESTROY(self, self.on_destroy)
def on_destroy(self, *args):
print "on_destroy", args
app = wxPySimpleApp()
frame = MyFrame()
frame.Show(true)
app.MainLoop()
Doesn't work here. It just exits when I close it via the window manager
and prints nothing.
Versions:
Python 2.1.3, wxPython 2.2.9, wxGTK 2.2.9
(all from debian packages)
Bernhard
--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
MapIt! http://www.mapit.de/
_______________________________________________
wxpython-users mailing list
wxpython-users@[...].org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users
Thread:
Jeff Kotula
Robin Dunn
Matthew Sherborne
Robin Dunn
Robin Dunn
Bernhard Herzog
Bernhard Herzog
Mike C. Fletcher
Steve Holden
|