[IPython-dev] Detecting GUI mainloop running in IPython

Brian Granger ellisonbg@gmail....
Sun Jul 25 16:05:07 CDT 2010


On Sun, Jul 25, 2010 at 1:35 PM, Gael Varoquaux <
gael.varoquaux@normalesup.org> wrote:

> On Sun, Jul 25, 2010 at 12:10:12PM -0700, Brian Granger wrote:
> >    * It is not sufficient to call the  relevant function methods in the
> >    GUI toolkits (like ``IsMainLoopRunning``)  because those don't know
> >    if the GUI event loop is running through the  input hook.
>
> OK, so this is the key part that I had missed. I could even call this a
> bug of the various toolkits.
>
> Is there any way to find out if the GUI event loop is running through
> the input hook at all?
>

Yes:

from IPython.lib import inputhook
inputhook.current_gui()

The possible values are:

GUI_WX = 'wx'
GUI_QT = 'qt'
GUI_QT4 = 'qt4'
GUI_GTK = 'gtk'
GUI_TK = 'tk'

>    Both matplotlib and ets have code that tries to [snip]
>
> The problem is a bit larger: it's not only about matplotlib, ets and
> IPython, it's a fairly general practice for plugin-like code to check if
> the eventloop is running before starting it.
>
>
Yes, and if such projects want to run in IPython, they are going to have to
add additional logic.  We spent a very long time to see if this could be
avoided and it cannot.  Our hope is that the additional logic can be
absolutely minimal.


> So, we have a problem and no solution (yet). The good news (I guess) is
> that IPython 0.11 is not in production yet. I am just worried about the
> bug reports landing in the various packages.
>

Yes, this stuff is definitely not release ready.

Thanks for your explanations. If you have any suggestions, I am open to
> try things out in Mayavi (which apart for this problem works just fine
> with 0.11).
>
>
Great.  I think we will need to wait until we have done the GUI integration
for the kernel/frontend before finalizing things, because there, the GUI
integration will be quite different.

Cheers,

Brian


> Gaël
>



-- 
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu
ellisonbg@gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20100725/3ab4cabc/attachment.html 


More information about the IPython-dev mailing list