Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e940795

Browse filesBrowse files
authored
Merge pull request #6734 from minrk/ipython-eventloops
MNT: register IPython's eventloop integration in plt.install_repl_displayhook
2 parents b65be40 + 09e4e62 commit e940795
Copy full SHA for e940795

File tree

Expand file treeCollapse file tree

1 file changed

+9
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-1
lines changed

‎lib/matplotlib/pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/pyplot.py
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ def install_repl_displayhook():
121121
Install a repl display hook so that any stale figure are automatically
122122
redrawn when control is returned to the repl.
123123
124-
This works with both IPython terminals and vanilla python shells.
124+
This works with IPython terminals and kernels,
125+
as well as vanilla python shells.
125126
"""
126127
global _IP_REGISTERED
127128
global _INSTALL_FIG_OBSERVER
@@ -154,6 +155,13 @@ def post_execute():
154155

155156
_IP_REGISTERED = post_execute
156157
_INSTALL_FIG_OBSERVER = False
158+
159+
# trigger IPython's eventloop integration, if available
160+
from IPython.core.pylabtools import backend2gui
161+
162+
ipython_gui_name = backend2gui.get(get_backend())
163+
if ipython_gui_name:
164+
ip.enable_gui(ipython_gui_name)
157165
else:
158166
_INSTALL_FIG_OBSERVER = True
159167

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.