ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxPython-users
wxPython-users
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved