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

Skip to content

Commit e02c375

Browse files
committed
Merge pull request #1651 from mdboom/webagg/pylab_compatibility
WebAgg: pylab compatibility
2 parents 09b9c04 + 4af9393 commit e02c375

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#import matplotlib.path as path
4242
from matplotlib import rcParams
4343
from matplotlib import is_interactive
44+
from matplotlib import get_backend
4445
from matplotlib._pylab_helpers import Gcf
4546

4647
from matplotlib.transforms import Bbox, TransformedBbox, Affine2D
@@ -100,6 +101,10 @@ def __call__(self, block=None):
100101
# IPython versions >= 0.10 tack the _needmain
101102
# attribute onto pyplot.show, and always set
102103
# it to False, when in --pylab mode.
104+
ipython_pylab = ipython_pylab and get_backend() != 'WebAgg'
105+
# TODO: The above is a hack to get the WebAgg backend
106+
# working with `ipython --pylab` until proper integration
107+
# is implemented.
103108
except AttributeError:
104109
ipython_pylab = False
105110

@@ -108,7 +113,7 @@ def __call__(self, block=None):
108113
if ipython_pylab:
109114
return
110115

111-
if not is_interactive():
116+
if not is_interactive() or get_backend() == 'WebAgg':
112117
self.mainloop()
113118

114119
def mainloop(self):

0 commit comments

Comments
 (0)