[IPython-dev] Status of IPython+GUI+Threads+PyOS_InputHook

Brian Granger ellisonbg.net at gmail.com
Sat Feb 7 11:00:39 EST 2009

Hello all,

I am trying to understand the current situation of how IPython
integrates with GUI event loops.  I am going to be doing some work on
the core soon, so I want to make sure I understand all of the
subtleties.  From looking at things, here is my take:

1. The IPython Core and any GUI event loop must be run in the same
thread and that thread must be the main thread if IPython is to offer
interactive GUI support.

2. PyOS_InputHook allows a function to be registered that will be
called periodically (by readline) while input is being entered at the
command line. This opens the door for GUI event loops to continue
running while a command line IPython is waiting for input. This is
only relevant for terminal based IPython shells though.  From what I
can tell, only Tk and recent releases of GTK and Qt4 support this

Does Wx support this?

If not, can we implement this ourselves?

I tried to use PyOS_InputHook this morning from ctypes, but it didn't
work.  Has anyone figured this out? Is PyOS_InputHook relevent for
non-teminal based IPython frontends?

In other words: can we get rid of the messy threading code in
IPython?!!! (please say yes)

3. SIgnals.  I know that one of the most subtle aspect of IPython is
getting signals working in the multithreaded shells.  How does this
change if we move to using PyOS_InputHook rather than our current GUI

4. There is an IPython commit by Darren Dale saying that the
PyOS_InputHook approach wasn't working fully, so it was disabled.  Did
we get to the bottom of this?



More information about the IPython-dev mailing list