[Tutor] how to call "~wxDialog()" in python?

Sean Richards sean64@xtra.co.nz
Wed Jul 23 16:13:13 2003


Thomas CLive Richards wrote:

> 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 tried escaping it with a '\' character, like you can do in some other
> languages, but that didn't seem to work either. I also thought that
> maybe the python wrapper to the wxWindows library had changed thename of
> this function, but i couldn't see any mention of it in the latest
> documentation.

Not a wxPython guru but I can point you in the direction of the wxPython
Wiki at http://wiki.wxpython.org for lots of examples and tips and
wxPython comes with a directory full of demo programs that covers just
about everything you need.

As for destroying a wxPython dialog you would use self.Destroy() to
destroy it. In the event handler you have written I think the normal
procedure is to use that to call a function you have defined something
like ...

EVT_BUTTON(self, EXIT_ID,self.Exit)

def Exit(self,event):
    """On exit Kill Everything. """
    self.Destroy()


Hope this helps a little. Get over to the wxPython wiki and have a look
around it will make things a lot easier.

Cheers, Sean

--
+---------------------------------------------------------------+
| All spelling errors are intentional and are there to show new |
| and improved ways of spelling old words.                      |
+---------------------------------------------------------------+

--
+---------------------------------------------------------------+
| All spelling errors are intentional and are there to show new |
| and improved ways of spelling old words.                      |
+---------------------------------------------------------------+