[SciPy-dev] gui_thread and wxPython-

Fernando Perez Fernando.Perez at colorado.edu
Fri Oct 1 15:28:42 CDT 2004

Prabhu Ramachandran schrieb:

> Essentially, I have wxPython-2.5.x apps working from IPython via
> gui_thread.  I don't have wxPython-2.4.x handy here but I don't think
> I have changed anything in the code for that.  There is one irritating
> warning message from pexec on exit from the interpreter but I can live
> with that.

This is great.  Having this work reliably will be a big boon for anyone 
wanting to do GUI work, but I'm most interested right now in matplotlib.  I've 
been working on trying to have ipython run all the matplotlib examples 
reliably, and the ones that try to build a full gui blow it up badly.  I've 
suggested to John adding an ipython trap, which would at least prevent the 
crashes.  But with the gui_thread work, we could simply build it in 
completely, and have a suggestion for new users:

1. Get scipy, matplotlib and ipython current.
2. Set your matplotlib GUI choice to WXAgg.
3. Everything works automatically!  Plots, full guis, interactive control of 
the gui from within the shell, etc.

I think this is the kind of setup which will really attract new users.

> I think I'll check in my changes in a little while.  Please do test it
> out and let me know if there are problems.  I'm particularly
> interested in other platforms, Windows, Mac and also wxPython-2.4.x.
> Here is a simple test you can run:
> import gui_thread
> gui_thread.start()

Is there any reason the gui_thread module can't just call start() itself upon 
import?  Are there valid situations where one may want to delay this call?

> from gui_thread.examples import SimpleFrame
> a = SimpleFrame()
> a.Show()
> a.SetTitle('Hey! this works!')

Unfortunately it doesn't work with 2.4:

In [2]: wx.VERSION
Out[2]: (2, 4, 2, 4, 'u')

New session:

In [1]: import gui_thread

In [2]: gui_thread.start()
Traceback (most recent call last):
   File "scipy_base/pexec.py", line 56, in run
     exec (code, frame.f_globals,frame.f_locals)
   File "<string>", line 3, in ?
ImportError: /usr/lib/python2.3/site-packages/wx/_core_.so: cannot open shared 
object file: No such file or directory

I can't build 2.5 right now, sorry.  2.4 is what my Fedora Core 2 box has:

Looking in Installed Packages:
Name                                Arch   Version                  Repo
wxPythonGTK2                        i386        db



More information about the Scipy-dev mailing list