File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -1098,12 +1098,17 @@ def _snap(self):
1098
1098
1099
1099
def _make_draggable (self , filepath = None ):
1100
1100
# Uncheck avtive pan/zoom actions of the matplotlib toolbar.
1101
- toolbar = getattr (self .m .BM .canvas , "toolbar" , None )
1102
- if toolbar is not None :
1103
- for key in ["pan" , "zoom" ]:
1104
- val = toolbar ._actions .get (key , None )
1105
- if val is not None and val .isCheckable () and val .isChecked ():
1106
- val .trigger ()
1101
+ # use a try-except block to avoid issues with ipympl in jupyter notebooks
1102
+ # (see https://github.com/matplotlib/ipympl/issues/530#issue-1780919042)
1103
+ try :
1104
+ toolbar = getattr (self .m .BM .canvas , "toolbar" , None )
1105
+ if toolbar is not None :
1106
+ for key in ["pan" , "zoom" ]:
1107
+ val = toolbar ._actions .get (key , None )
1108
+ if val is not None and val .isCheckable () and val .isChecked ():
1109
+ val .trigger ()
1110
+ except AttributeError :
1111
+ pass
1107
1112
1108
1113
self ._filepath = filepath
1109
1114
self .modifier_pressed = True
You can’t perform that action at this time.
0 commit comments