Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 24e43b3

Browse files
committed
Fix FigureManager to allow pyplot to work for non GUI backends
1 parent 1d2095b commit 24e43b3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/backend_managers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def __init__(self, figure, num, **kwargs):
8282

8383
self._is_gui = hasattr(self._backend, 'Window')
8484
if not self._is_gui:
85+
self.window = None
8586
return
8687

8788
self._mainloop = self._backend.MainLoop()
@@ -185,7 +186,8 @@ def set_window_title(self, title):
185186
Set the title text of the window containing the figure. Note that
186187
this has no effect for non-GUI backends (e.g., a PS backend).
187188
"""
188-
self.window.set_window_title(title)
189+
if self.window:
190+
self.window.set_window_title(title)
189191

190192
@property
191193
def backend(self):

0 commit comments

Comments
 (0)