Skip to content

Commit

Permalink
Merge pull request matplotlib#6734 from minrk/ipython-eventloops
Browse files Browse the repository at this point in the history
MNT: register IPython's eventloop integration in plt.install_repl_displayhook
  • Loading branch information
tacaswell committed Jul 16, 2016
1 parent 416c2a2 commit a61f763
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def install_repl_displayhook():
Install a repl display hook so that any stale figure are automatically
redrawn when control is returned to the repl.
This works with both IPython terminals and vanilla python shells.
This works with IPython terminals and kernels,
as well as vanilla python shells.
"""
global _IP_REGISTERED
global _INSTALL_FIG_OBSERVER
Expand Down Expand Up @@ -155,6 +156,13 @@ def post_execute():

_IP_REGISTERED = post_execute
_INSTALL_FIG_OBSERVER = False

# trigger IPython's eventloop integration, if available
from IPython.core.pylabtools import backend2gui

ipython_gui_name = backend2gui.get(get_backend())
if ipython_gui_name:
ip.enable_gui(ipython_gui_name)
else:
_INSTALL_FIG_OBSERVER = True

Expand Down

0 comments on commit a61f763

Please sign in to comment.