GUI libs

A. Lloyd Flanagan alloydflanagan at attbi.com
Fri Apr 25 17:00:47 EDT 2003


Gerhard Haering <gh at ghaering.de> wrote in message news:<mailman.1051277805.18035.python-list at python.org>...
<big snip>
> 
> C:\>python
> Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> from wxPython.wx import *
>  >>> f = wxFrame(NULL, 1, "foo")
>  >>> f.Show()
> 
> This will segfault Python. IIRC, this was what I did in my very first 
> exploration of wxPython.
> 
> I believe the reason of this crash is that the wxWindows main loop isn't 
> initialized, yet. What I've done may be not very clever, but in my 
> opinion, a Python app should *never* crash. The whole point of me using 
> a highly dynamic language like Python is that it will give me exceptions.

That's a good point.  You can avoid a crash by doing 
app = wxPySimpleApp()
before creating the wxFrame.  But then your frame won't do anything
until you execute
app.MainLoop()
at which point you can't get back to the interpreter until the
application has exited.  Maybe we could start the loop in a separate
thread...




More information about the Python-list mailing list