Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add AxesWidget base class to handle event activation and clean up. #724

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 8 commits into from
Mar 17, 2012
Prev Previous commit
Next Next commit
Remove duplicate code in SpanSelector.__init__.
  • Loading branch information
tonysyu committed Feb 28, 2012
commit 0f0286ea39eaa95282a46c7ae245f0a2fe52a922
21 changes: 3 additions & 18 deletions 21 lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,24 +1000,9 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
self.buttonDown = False
self.prev = (0, 0)

self.connect_event('motion_notify_event', self.onmove)
self.connect_event('button_press_event', self.press)
self.connect_event('button_release_event', self.release)
self.connect_event('draw_event', self.update_background)

if self.direction == 'horizontal':
trans = blended_transform_factory(self.ax.transData, self.ax.transAxes)
w,h = 0,1
else:
trans = blended_transform_factory(self.ax.transAxes, self.ax.transData)
w,h = 1,0
self.rect = Rectangle( (0,0), w, h,
transform=trans,
visible=False,
**self.rectprops
)

if not self.useblit: self.ax.add_patch(self.rect)
# Reset canvas so that `new_axes` connects events.
self.canvas = None
self.new_axes(ax)

def new_axes(self,ax):
self.ax = ax
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.