Skip to content

Commit e9f4af6

Browse files
committed
show for tkagg doesn't block in script called via ipython -pylab.
This is the first in an expected series of changes to show(). svn path=/branches/v1_0_maint/; revision=8557
1 parent 2d8a24a commit e9f4af6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ def show():
7171
"""
7272
for manager in Gcf.get_all_fig_managers():
7373
manager.show()
74-
Tk.mainloop()
74+
try:
75+
if not show._needmain: # might have been added by ipython
76+
return
77+
except AttributeError:
78+
pass
79+
if not matplotlib.is_interactive():
80+
Tk.mainloop()
7581

7682
def new_figure_manager(num, *args, **kwargs):
7783
"""

0 commit comments

Comments
 (0)