wxPython gotchas

Austin Luminais alun at chromosome57.com
Thu Aug 29 19:20:57 CEST 2002


"Rob Hall" <bloke at ii.net> wrote in message news:<3d6d91c0$0$28695 at echo-01.iinet.net.au>...
> I've just started experimenting with wxPython, and up till now have been
> very impressed.  _Much_ easier than tkinter.
> 
> 
> Has anyone found any nasty 'gotchas' I should look out for?

There is one thing I found, but it is specific to Windows and MDI.
If you use MDIChildFrames, have more than one child frame on screen,
and maximize one, and then attempt to close the frame while it is
maximized, wxPython/wxWindows crashes.

Turns out this only happens if the frame is set to AutoLayout, or are
specifying an OnSize method and calling Layout there (basically, if
you have a control that resizes itself).  It seems that what happens
is a size event is sent AFTER the window has been closed, which is the
cause of the problem.

The workaround I use is to define OnSize and OnClose handlers like
this:

    def OnSize(self, event):
        if not self.closed:
            event.Skip()

    def OnClose(self, event):
        event.Skip()
        self.closed = 1

Aside from this, I've been using wxPython on Windows for over a year
and have had very few problems.



More information about the Python-list mailing list