[IPython-dev] control is not returned to main program, when plotting

Thomas Spura tomspur at fedoraproject.org
Fri Jan 14 03:48:43 EST 2011

Hi list,

When running the latest commit of the 0.10.2 branch, the control is not
returned in -pylab mode.

* running ./ipython.py -pylab
* typing 'plot()'
* nothing happens
* typing 'show()'
* control is not returned, even when closing the window

This problem is because check_gtk sets interactive to false and returns
the tkthread backend. But when using -gthread (which is default here),
everything runs as expected.

The patch below fixes the problem for me, but do'nt know if it's a
proper fix.

(CC'ing the author of commit 3e84e9f446b752aef4c798b3a086084b5cdcb679,
which is the first bad commit)


diff --git a/IPython/Shell.py b/IPython/Shell.py
index 38006d7..2f0b5b4 100644
--- a/IPython/Shell.py
+++ b/IPython/Shell.py
@@ -1233,7 +1233,8 @@ def _select_shell(argv):
                 th_mode = 'tkthread'
             # New versions of pygtk don't need the brittle threaded
-            th_mode = check_gtk(th_mode)
+            if th_mode not in ['gthread']:
+                th_mode = check_gtk(th_mode)
         return mpl_shell[th_mode]

More information about the IPython-dev mailing list