[IPython-user] ipython embedded in a responsive GTK application?

Fernando Perez fperez.net at gmail.com
Wed Aug 9 00:43:22 CDT 2006

Hi John,

On 8/8/06, John Pye <john.pye at student.unsw.edu.au> wrote:
> Hi there
> I've read your notes on embedding ipython in other applications, and I
> succeeded in adding an interface to the ASCEND modelling system
> (https://pse.cheme.cmu.edu/wiki/view/Ascend/WebHome) that allows me to
> query our object heirarchy.
> Unfortunately I haven't been able to discover (a) how to keep the main
> GTK window response after firing up the console and (b) how to make the
> console input/output appear in a new xterm window in front of the main
> GTK window.
> Although currently our application is a console-plus-popup-window
> application, we ultimately intend that it will run without any need for
> the original console, and for that reason, we'd want the ipython console
> to be activated in a new window.
> I assumed I would be able to do this using perhaps the python
> 'subprocess' module coupled with ipython, but I haven't been able to
> work it out yet. Any help would be appreciated.

unfortunately, the embedding facilities don't use the threading
support correctly, so 'out of the box', you can't quite do this.  This
was due to pure oversight and the way the code evolved, with both the
threading classes and the embedding ones extending a base, but without
knowing about each other as they should.  As with most of ipython, my
poor design skills and lack of long-term foresight...

But it can be done with a bit of hacking even today, without waiting
for a cleaner architecture to be available (which /is coming/ but
isn't ready).  I'd suggest you poke around a little in the Shell.py


this is where both the embedding and the threaded classes are defined.
 With a bit of duct-tape and a cup of coffee, it should be pretty
straightforward to assemble one which does both for your purposes.
I'll be happy to give you a hand if you get stuck.



More information about the IPython-user mailing list