From 2e31f660c7f9d0a870c97aead6f1f749efb57a5e Mon Sep 17 00:00:00 2001 From: Eric Firing Date: Mon, 6 May 2013 16:45:18 -1000 Subject: [PATCH] Fix bug in SpanSelector, introduced in commit #dd325759 The useblit attribute was being set after calling new_axes, but new_axes needs that attribute. By setting useblit before calling new_axes, we set it based on the initial canvas; even though new_axes might change to a different canvas, we assume it will be the same type of canvas (same backend), so its supports_blit attribute will not change. --- lib/matplotlib/widgets.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 5e2ec4e11af6..eabff7dd6536 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -1072,10 +1072,12 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False, self.buttonDown = False self.prev = (0, 0) + # Set useblit based on original canvas. + self.useblit = useblit and self.canvas.supports_blit + # 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