@@ -146,6 +146,10 @@ def _get_data_coords(self, event):
146
146
return ((event .xdata , event .ydata ) if event .inaxes is self .ax
147
147
else self .ax .transData .inverted ().transform ((event .x , event .y )))
148
148
149
+ def ignore (self , event ):
150
+ # docstring inherited
151
+ return super ().ignore (event ) or self .canvas is None
152
+
149
153
150
154
class Button (AxesWidget ):
151
155
"""
@@ -1087,7 +1091,7 @@ def __init__(self, ax, labels, actives=None, *, useblit=True,
1087
1091
1088
1092
def _clear (self , event ):
1089
1093
"""Internal event handler to clear the buttons."""
1090
- if self .ignore (event ) or self .canvas is None or self . canvas .is_saving ():
1094
+ if self .ignore (event ) or self .canvas .is_saving ():
1091
1095
return
1092
1096
self ._background = self .canvas .copy_from_bbox (self .ax .bbox )
1093
1097
self .ax .draw_artist (self ._checks )
@@ -1665,7 +1669,7 @@ def __init__(self, ax, labels, active=0, activecolor=None, *,
1665
1669
1666
1670
def _clear (self , event ):
1667
1671
"""Internal event handler to clear the buttons."""
1668
- if self .ignore (event ) or self .canvas is None or self . canvas .is_saving ():
1672
+ if self .ignore (event ) or self .canvas .is_saving ():
1669
1673
return
1670
1674
self ._background = self .canvas .copy_from_bbox (self .ax .bbox )
1671
1675
self .ax .draw_artist (self ._buttons )
@@ -2183,9 +2187,9 @@ def connect_default_events(self):
2183
2187
2184
2188
def ignore (self , event ):
2185
2189
# docstring inherited
2186
- if self . canvas is None :
2190
+ if super (). ignore ( event ) :
2187
2191
return True
2188
- if not self .active or not self . ax .get_visible ():
2192
+ if not self .ax .get_visible ():
2189
2193
return True
2190
2194
# If canvas was locked
2191
2195
if not self .canvas .widgetlock .available (self ):
0 commit comments