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

Skip to content

Lasso selector #730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 17, 2012
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ class Widget(object):


class AxesWidget(Widget):
"""
Widget that is connected to a single :class:`Axes`.

Attributes
----------
*ax*
The parent :class:`matplotlib.axes.Axes` for the widget
*canvas*
The parent FigureCanvas for the widget
"""Widget that is connected to a single :class:`~matplotlib.axes.Axes`.

Attributes:

*ax* : :class:`~matplotlib.axes.Axes`
The parent axes for the widget
*canvas* : :class:`~matplotlib.backend_bases.FigureCanvasBase` subclass
The parent figure canvs for the widget.
*active* : bool
If False, the widget does not respond to events.
"""
def __init__(self, ax):
self.ax = ax
Expand All @@ -81,10 +82,16 @@ def __init__(self, ax):
self.active = True

def connect_event(self, event, callback):
"""Connect callback with an event.

This should be used in lieu of `figure.canvas.mpl_connect` since this
function stores call back ids for later clean up.
"""
cid = self.canvas.mpl_connect(event, callback)
self.cids.append(cid)

def disconnect_events(self):
"""Disconnect all events created by this widget."""
for c in self.cids:
self.canvas.mpl_disconnect(c)

Expand Down