[IPython-dev] Interactive wx/pylab with no threads (PyOS_InputHook)

Prabhu Ramachandran prabhu at aero.iitb.ac.in
Thu Feb 12 05:40:21 EST 2009


On 02/09/09 05:38, Brian Granger wrote:
> IPython and matplotlib devs,
> 
> Over the weekend I have been playing around to see if it is possible
> to do interactive GUI work with wx from IPython *without using
> threads*.  The idea here is to use PyOS_InputHook.  Currently, recent
> versions of PyQt4 and PyGTK do this and if we can get wx working, we
> can probably get rid of IPython's subtle threaded shells that
> currently allow interactive GUIs to work.
> 
> I am attaching a Cython module that mostly works.  Here is a simple
> example that works in IPython (without the -wthread option!)
[...]
> I don't have any more time to work on this right now, but I at least
> wanted to share my findings with both IPython and matplotlib devs.  It
> would be great if someone familiar with wx could try to figure out the
> remaining issues.  If there are no takers here, I might eventually see
> if wxpython itself is interested in this code (that is probably where
> it really belongs anyway).

This is cool!  It works with mayavi, which is a pretty demanding test. 
I did run into problems with pyximport messing up on some imports but 
manually importing the inputhook.so fixed those.  The interactive 
response is not snappy but it definitely works without a problem.

One problem I can see with this is that while it does eliminate the 
threading, there are still issues with multiple toolkits.  It would be 
neat if there were a system where you could mix toolkits too -- it looks 
like it should be possible to support this though.

cheers,
prabhu



More information about the IPython-dev mailing list