Skip to content
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

Fix initialization problem with useblit on SpanSelector instance creatio... #1971

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/matplotlib/widgets.py
Expand Up @@ -1066,6 +1066,7 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
self.rectprops = rectprops
self.onselect = onselect
self.onmove_callback = onmove_callback
self.useblit = useblit
self.minspan = minspan

# Needed when dragging out of axes
Expand All @@ -1075,14 +1076,15 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
# Reset canvas so that `new_axes` connects events.
self.canvas = None
self.new_axes(ax)
self.useblit = useblit and self.canvas.supports_blit

def new_axes(self, ax):
self.ax = ax
if self.canvas is not ax.figure.canvas:
self.disconnect_events()

self.canvas = ax.figure.canvas
# check to see if new canvas supports blitting and, if not, disable
self.useblit = self.useblit and self.canvas.supports_blit
self.connect_event('motion_notify_event', self.onmove)
self.connect_event('button_press_event', self.press)
self.connect_event('button_release_event', self.release)
Expand Down