Comment 7 for bug 270856

Revision history for this message
Michiel de Hoon (mjldehoon) wrote :

> I am not questioning your patch - rather, I'm thinking that if we
> leave in the interactive event loop, we can make ipython interface
> with gtk in a single threaded (read: robust and simple) fashion, just
> like it does with tk.

Yes, that should be possible, as in principle GTK's interactive event loop works the same as Tkinter's event loop.

> Please run the attached file (pylabgtk.py). My gtk ( 2.12.1-0ubuntu1 )
> does not have set_interactive, so you are > probably using a newer
> version. However, if your pygtk works the way I expect it to work, you
> can enter plot() and continue running ipython normally...

pylabgtk.py works for me. I just needed to add gtk.main_quit() and sys.exit() inside the run_ipython function after the shell.mainloop() to make sure that ipython exits cleanly. Otherwise, it seems to work fine. The plot function brings up the matplotlib window, which is responsive, and I get the ipython prompt back without having to close the window.

Note that the set_interactive stuff is now in the bleeding-edge developer version of pygtk and not yet in an official release, and users may not yet be able to use this stuff until the next release of pygtk.