[IPython-dev] Uniform GUI support across matplotlib, ets and ipython

Brian Granger ellisonbg at gmail.com
Sat Aug 28 15:42:45 EDT 2010

Hi all,

As  you may know, this summer we have been working on a new two
process IPython that has a beautiful Qt frontend GUI and a ZMQ based
messaging layer between that GUI and the new IPython kernel.  Many
thanks to Enthought for funding this effort!

We are currently in the process of adding GUI event loop integration
to the ipython kernel so users can do interactive plotting like they
can with the regular ipython.  You may also remember that last summer
we implemented a new PyOs_InputHook based GUI integration for the
regular ipython.  This has not been released yet, but all of this will
be released in the upcoming 0.11 release.

I am emailing everyone because we see that there is a need for all of
us to agree on two things:

1.  How to detect if a GUI application object has been created by someone else.
2.  How to detect if a GUI event loop is running.

Currently there is code in both ETS and matplotlib that fails to
handle these things properly in certain cases.  With IPython 0.10,
this was not a problem because we used to hijack/monkeypatch the GUI
eventloops after we started them.  In 0.11, we will no longer be doing
that.  To address these issues, we have created a standalone module
that implements the needed logic:


This module is heavily commented and introduces a new informal
protocol that all of use  can use to detect if event loops are
running.  This informal protocol is inspired by how some of this is
handled inside ETS.  Our idea is that all projects will simply copy
this module into their code and ship it.  It is lightweight and does
not depend on IPython or other top-level imports.  As you will see, we
have implemented the logic for wx and qt4, we will need help with
other toolkits.  An important point is that matplotlib and ets WILL
NOT WORK with the upcoming release of IPython unless changes are made
to their respective codebases.  We consider this a draft and are more
than willing to modify the design or approach as appropriate.  One
thing that we have not thought about yet is how to continue to support
0.10 within this model.

The good news amidst all of this is that the quality and stability of
the GUI support in IPython is orders of magnitude better than that in
the 0.10 series.



PS:  If you are curious, here is a bit of background on the issues
related to the PyOS_Inputhook stuff:


More information about the IPython-dev mailing list