[IPython-dev] Next PyGtk is going to rock the pylab

Ville M. Vainio vivainio@gmail....
Wed Sep 17 02:29:07 CDT 2008


Once the "bleeding edge" of pygtk is released, we will have a pylab
gtk backend that is as stable and simple as the Tk backend. I.e. no
more threading woes.

I'd like to draw everyone's attention to the discussion in this bug report:

https://bugs.launchpad.net/ipython/+bug/270856

All that is needed to create the single threaded gtk matplotlibshell
is this (note that it does not use "gui specific" shell, just the
launcher code is gui specific - it uses the plain vanilla
IPython.Shell.IPShellMatplotlib()):

#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Launch matplotlibshell using gtk """

import gtk,gobject
import IPython.Shell
live = False

def run_ipython():
    global live
    if live:
        return False

    live = True
    shell = IPython.Shell.IPShellMatplotlib()
    IPython.Shell.hijack_gtk()
    shell.mainloop()

gobject.idle_add(run_ipython)
# the following line does not work on current pygtk
#gtk.set_interactive(True)
gtk.main()


-- 
Ville M. Vainio
http://tinyurl.com/vainio


More information about the IPython-dev mailing list