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

Skip to content

Commit 13ce609

Browse files
committed
Move widget.{get,set}_active to AxisWidget.
The method was previously defined only for RectangleSelectors (#3375). Also, an redundant line was removed (RectangleSelectors are already set active on __init__ by the superclass).
1 parent b1ebb3c commit 13ce609

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

lib/matplotlib/widgets.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ def disconnect_events(self):
111111
for c in self.cids:
112112
self.canvas.mpl_disconnect(c)
113113

114+
def set_active(self, active):
115+
"""Set whether the widget is active.
116+
"""
117+
self.active = active
118+
119+
def get_active(self):
120+
"""Get whether the widget is active.
121+
"""
122+
return self.active
123+
114124
def ignore(self, event):
115125
"""Return True if event should be ignored.
116126
@@ -1393,7 +1403,6 @@ def __init__(self, ax, onselect, drawtype='box',
13931403
self.connect_event('button_release_event', self.release)
13941404
self.connect_event('draw_event', self.update_background)
13951405

1396-
self.active = True # for activation / deactivation
13971406
self.to_draw = None
13981407
self.background = None
13991408

@@ -1575,17 +1584,6 @@ def onmove(self, event):
15751584
self.update()
15761585
return False
15771586

1578-
def set_active(self, active):
1579-
"""
1580-
Use this to activate / deactivate the RectangleSelector
1581-
from your program with an boolean parameter *active*.
1582-
"""
1583-
self.active = active
1584-
1585-
def get_active(self):
1586-
""" Get status of active mode (boolean variable)"""
1587-
return self.active
1588-
15891587

15901588
class LassoSelector(AxesWidget):
15911589
"""Selection curve of an arbitrary shape.

0 commit comments

Comments
 (0)