Hello,<div><br></div><div>I have written an ipython extension for a library called PyTango.</div><div><br></div><div>In this extension I subscribe to events through a callback function which is executed in a "random" thread.</div>


<div>The callback simply uses pylab to do a plot using the event information.</div><div><br></div><div>1. In IPython 0.10:</div><div>  To avoid Qt calls outside the MainThread the callback actually emits a signal. The slot which is connected to it does the actual pylab.plot call.</div>


<div>  I simply activate -pylab and -q4thread and everything works fine.</div><div><br></div><div>2. In IPython 0.12 / 0.13:</div><div>  2.1 If ipython is started in console mode the solution I used for IPython 0.10 works like a charm</div>


<div>  2.2 If ipython is started in qtconsole mode with pylab=qt the solution I used for IPython 0.10 also works</div><div><br></div><div>  2.3 If ipython is started in qtconsole mode with pylab='inline' the solution I used for IPython 0.10 doesn't work (the signal is emited but the slot is never called).</div>


<div>    2.3.1 If I replace the callback that emits a signal with the actual plot then it works... but then cases 2.1 and 2.2  don't work anymore.</div><div><br></div><div>I guess the solution here is to determine in which of the following 3 "modes" the ipython is running </div>


<div>  - terminal-based with pylab=qt</div><div>  - QtConsole with pylab=qt </div><div>  - QtConsole with pylab=inline</div><div><br></div><div>I know how to check for pylab mode:</div><div>app = IPython.Application.instance()</div>


<div>app.pylab == "qt"</div><div><br></div><div>... but how do I find out which is the fronted being used? </div><div>I wanted to avoid something nasty like for obvious reasons:</div><div>app = IPython.Application.instance()</div>


<div>is_terminal_based = isinstance(app, IPython.frontend.terminal.ipapp.TerminalIPythonApp)</div><div><p style="margin:0px">is_qt_console = isinstance(app, IPython.zmq.ipkernel.IPKernelApp)</p></div>