[IPython-User] Putting a kernel inside a GUI (WX or Qt) application so you can run external Qt consoles against it.
Thu Aug 11 10:28:27 CDT 2011
I confirm that when starting a kernel with IPKernelApp, I always get a
"hb" port = 0. which is a problem when trying to connect a frontend to
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from IPython.zmq.ipkernel import IPKernelApp
>>> kernel = IPKernelApp()
>>> kernel.initialize(['python', '--pylab=qt'])
[IPKernelApp] To connect another client to this kernel, use:
[IPKernelApp] --existing --shell=54717 --iopub=56526 --stdin=53981 --hb=0
2011/8/10 Pierre Raybaut <firstname.lastname@example.org>:
> Hi Fernando,
> I'm in the middle of my vacations but I heard of the v0.11 release so
> I couldn't resist to test some things and begin to think about the
> future of IPython integration in Spyder.
> First of all, congratulations to the IPython dev team for this
> impressive new release. Some details (like the excellent documentation
> or the great-looking website) show that a lot of work has been done
> and you should be proud of the result. I'm really excited to
> contribute to the promotion of IPython through Spyder!
> A lot of things were broken in Spyder with this new release of IPython:
> The essential part has already been taken care of (especially on
> non-Windows platforms, everything is almost back to normal).
> For the future, I'm thinking of a new dedicated Spyder plugin, the
> IPython plugin, which would be based on IPython v0.11's Qt console. I
> hope that, in time, you will be able to cite this application of
> IPython Qt console as an example...
> As I mentioned on my blog, the critical part should be the variable
> explorer support -- currently, Spyder is already using a two-process
> architecture with sockets communicating things for code introspection
> (code completion, calltips, ...) and for the variable explorer
> management (getting namespace contents, getting/sending variables
> contents, and so on).
> However, being in the middle of my vacations, I won't be very
> efficient for coding new things, at least in the next two weeks. So I
> won't bother you with all my naive technical questions right now.
> Anyway, a Spyder user mentioned this post of yours and so I tried to
> run the 'ipkernel_qtapp.py' on my Windows machine, and it crashes when
> I click on the "Qt console" button. Apparently, the embedded IPython
> kernel is started with bad parameters and I don't know why exactly
> (the 'hb' port is 0, which is the cause of the crash when trying to
> run a Qt Console with these parameters):
> [IPKernelApp] To connect another client to this kernel, use:
> [IPKernelApp] --existing --shell=57119 --iopub=61366 --stdin=55688 --hb=0
> 2011/8/5 <email@example.com>:
>> Date: Fri, 5 Aug 2011 00:20:02 -0700
>> From: Fernando Perez <firstname.lastname@example.org>
>> Subject: [IPython-User] Putting a kernel inside a GUI (WX or Qt)
>> application so you can run external Qt consoles against it.
>> To: IPython User list <email@example.com>
>> Content-Type: text/plain; charset=ISO-8859-1
>> Hi all,
>> [ forgot to CC the user list, where people who aren't on the dev list
>> may care about this... ]
>> we knew this was in principle possible given the new architecture, but
>> in working with a colleague today I had to actually implement it, so
>> I've committed these as examples (they only need 0.11 to run, so you
>> can just copy these files if you want to play with them, or pull from
>> Those two both use the same common machinery:
>> The idea is that you can have a full IPython kernel embedded in any
>> GUI app (in this case, shown with either WX or Qt), and the app can
>> then fire up a Qt console (or you can attach one externally). The GUI
>> app is modifying variables (the Count++ button) and dumping the user
>> namespace to the console via buttons, while the Qt console can plot
>> variables, run code, etc, that's in the namespace dict.
>> These examples show that it actually takes very little code, and that
>> this extra code is fairly generic (I used the same code for both the
>> Qt and the WX examples). In a real application it would be structured
>> slightly differently, but the ideas should be clear from this simple
>> I hope this is useful, since this is something that I've been asked
>> *many* times over the years.
More information about the IPython-User