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
[wxPython-users] How do I catch the close event on an XRC loaded dialog?
by Ron Arts other posts by this author
Dec 12 2004 5:29PM messages near this date
[wxPython-users] _get_document() in iewin | [wxPython-users] EVT_GRID_RANGE_SELECT GetTopRow
Hello,

I have a problem catching events in XRC loaded dialog.
I want to catch the close event. My code is as follows:

--------------
from wxPython.wx import *
from wxPython.xrc import *

class PreferencesDialog(wxDialogPtr):
     def __init__(self,parent,res):
         w = res.LoadDialog(parent, "Preferences")
         wxDialogPtr.__init__(self, w.this)
         self.Center()
         EVT_CLOSE(self.OnClose)

     def OnClose(self,e):
         # do something here


in the main App:

     def OnPrefs(self, event):
         self.res = wxXmlResource("myapp_wdr.xrc")
         dlg = PreferencesDialog(self, self.res)
         dlg.ShowModal()
         dlg.Destroy()

--------------

But I get the following error:

Traceback (most recent call last):
   File "./astium.py", line 61, in OnPrefs
     dlg = PreferencesDialog(self, self.res)
   File "./prefs.py", line 34, in __init__
     EVT_CLOSE(self.OnClose)
AttributeError: 'Dialog' object has no attribute 'OnClose'

If I leave out the EVT_CLOSE, the dialog works properly.
I use wxPythonGTK-py2.2-2.5.2.8-1, and wxDesigner to
generate the XML resources.

Ron
Attachments:
smime.p7s

Thread:
Ron Arts
wxgreg

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