I'd like to embed an IPython shell inside a graphical Gtk+ program. The traditional IPython embedding API is geared towards console usage.
It should be possible to export program variables to the shell so that the user can use the shell to interact with the rest of the program.
Some work was done in the ns-3 project to update the embedding of IPython into GTK-2, from around 2014. That code looks like it might be compatible with IPython 4.x but not with 5.x. As of IPython 5.x, everything seems to have changed: see the new documentation. But there is also a rough patch that makes this work in IPython 5, at least in a basic way.
From the above, a patched and working version of ipython_view.py
is at:
http://code.ascend4.org/ascend/trunk/pygtk/ipython_view.py?view=markup
Test it using:
python python-iview.py
It seems to work OK on both Ubuntu 17.10 (IPython 5.1.0) and Ubuntu 16.04 (IPython 2.4.1). The color prompt is not enabled (yet) with the IPython 5.x version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With