[SciPy-dev] New implementation for gui_thread

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Fri Oct 10 01:58:06 CDT 2003


>>>>> "PP" == Pearu Peterson <pearu at scipy.org> writes:

    PP> I have succesfully finished implementing new hooks for
    PP> importing wxPython to its own thread. The working idea is that
    PP> all wxPython extension modules (that contain only low-level
    PP> functions) are transparently replaced with wrappers that
    PP> direct wx execution to a different thread so that Python
    PP> prompt will be available for interactive work even when a
    PP> wxPython application is running.

Nice!  I briefly looked at the code and from what I can see you
transparently wrap the builtin functions used inside all the wxPython
functions.  This means apply is wrapped and therefore everything works

I've managed to work around the kiva_agg build problem by building the
offending code with gcc-3.0.  How does one specify to python setup.py
to choose gcc-3.0 instead of vanilla gcc?  Setting the environment
variable CC does not appear to help.

Anyway, the new gui_thread works really nicely.  I like the fact that
you don't have to wait before you run the next statement since you
wait while importing wxPython.  However, the new gui_thread appears to
have trouble when quitting the interpreter:

In [1]: from gui_thread import wxPython_thread; wxPython_thread()
In [2]: from chaco.wxplt import *
In [3]: p=plot([1,2])
In [4]: close()
In [5]: 
Do you really want to exit ([y]/n)? 
Exception in thread Thread-221:
Traceback (most recent call last):
  File "/usr/lib/python2.2/threading.py", line 408, in __bootstrap
  File "/usr/local/stow/scipy/lib/python2.2/site-packages/gui_thread/wxBackgroundApp.py", line 65, in run
    exec self.cmd in self.globs,self.locs
  File "<string>", line 1, in ?
AttributeError: wxBackgroundApp instance has no attribute 'event_catcher'


More information about the Scipy-dev mailing list