[IPython-dev] Status of IPython+GUI+Threads+PyOS_InputHook
dsdale24 at gmail.com
Sat Feb 7 11:48:07 EST 2009
On Sat, Feb 7, 2009 at 11:00 AM, Brian Granger <ellisonbg.net at gmail.com>wrote:
> 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?
I think you are referring to a comment from 2008-02-07 in
docs/attic/Changelog, is that right? IPython's Qt threading support is
implemented the same way as the other gui toolkits, using IPython's
infrastructure, which was conflicting with Qt's use of PyOS_InputHook. I
dont remember all the details, there was some discussion on the ipython
mailing list around the the time of that commit, it boiled down to starting
ipython with -q4thread, and attempting to "run qt4_foo.py" which started the
main loop by calling QApplication.exec_(), which blocked. Phil Thompson
suggested the call to remove pyqt4's use of the input hook. I don't think we
have ever tried relying solely on pyqt4's built in support for interactive
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev