[SciPy-dev] Generic gui_thread + IPython: solution already exists!
Fernando Perez
Fernando.Perez at colorado.edu
Sun Nov 14 16:54:20 EST 2004
Prabhu Ramachandran wrote:
> [Sorry about the cross-posting, but I think this is relevant on both
> lists.]
>
> I just happened to read Fernando's post on c.l.py on the way in which
> IPython manages to get gtk and wxPython working for matplotlib. Here
> is the thread:
>
> http://xrl.us/dyej
>
> I then looked at IPython/Shell.py and realized that IPython can
> actually be trivially extended to work with *any* wx or gtk app!
>
> I actually thought of using this approach earlier when I was fixing
> gui_thread, but thought IPython would need too many modifications for
> this to work. However, it looks like Fernando has already done all
> the work for us.
Well, I think the real credit should go to John Hunter and Antoon Pardon, the
people who cracked the nut of the threading code originally :)
This is great news, obviously!
This is very much what Eric and I originally discussed at scipy'04, and what I
thought might be possible to do. While fumbling in the dark with my near-zero
knowledge of threading, in an attempt to get matplolib running, I finally
thought that perhaps this approach was just not viable, and that the full
complexity of gui_thread was indeed inevitable. I basically was not willing
to believe that such a simple approach could indeed substitute all the
functionality of gui_thread, and gave up in my ignorance. I'm happy to see
that my original hunch was indeed right :)
The leftover machinery for -wthread/-gthread which you see there is all that's
left of my efforts. I'm glad I didn't completely wipe that out. Re-enabling
it is trivial, and I even had written the relevant manual parts for it, so
this would be an easy fix.
I would be more than happy to put out a 0.6.5 release with these fixes, since
I think they would be a _major_ enhancement to ipython. People have been
asking for a long time for a way to use wx/gtk interactively, and if this
solution truly can substitute gui_thread, I think it's a major win.
gui_thread is complex and brittle, and the work of maintaing it is a solid
time sink with a developer bottleneck: basically only you and Pearu (I think)
understand that code enough to dare stick your fingers in it. IMO it would be
great if we could just get rid of it without loss of functionality.
I don't have the necessary expertise to properly test this out for both
wx/gtk, but I'd love to see these improvements go in, so I hope you or someone
else can finish them up.
Great work!
Best,
f
More information about the SciPy-Dev
mailing list