[Tutor] how to call "~wxDialog()" in python?
Jorge Godoy
godoy@metalab.unc.edu
Tue Jul 22 07:41:01 2003
Thomas CLive Richards <thomi@thomi.imail.net.nz> writes:
> when trying to destroy a (WxWindows) window, I have to call a function
> called "self.~wxDialog()" However, python complains about the '~'
> character:
>
> thomi@Julie:~/work/python sources/wxPython$ ./wedderburn.py
> File "./wedderburn.py", line 146
> EVT_BUTTON(self,ID_PREFS_CLOSEBUTTON,self.~wxDialog)
> ^
> SyntaxError: invalid syntax
I use the following to close my dialogs:
======================================================================
class About(wxDialog):
def __init__(self, *args, **kwds):
# begin wxGlade: About.__init__
(...)
self.button_4 = wxButton(self.panel_5, -1, "Fechar")
(...)
# end wxGlade
(...)
EVT_BUTTON(self, -1, self.OnExit)
(...)
def OnExit(self, event):
self.Close(True)
======================================================================
I.e., I let the only button on the dialog with the standard ID of '-1'
and associate it to a function 'OnExit' in the same class.
See you,
--
Godoy. <godoy@metalab.unc.edu>