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

Skip to content

Commit feb58fe

Browse files
tacaswellblink1073
authored andcommitted
FIX: do not call draw_idle if blitting
- make sure all blitted artists are marked as 'animated' - use `self.update` instead of `canvas.draw_idle` in extent setter
1 parent 545a727 commit feb58fe

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/matplotlib/widgets.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,8 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
14181418
if rectprops is None:
14191419
rectprops = dict(facecolor='red', alpha=0.5)
14201420

1421+
rectprops['animated'] = useblit
1422+
14211423
if direction not in ['horizontal', 'vertical']:
14221424
msg = "direction must be in [ 'horizontal' | 'vertical' ]"
14231425
raise ValueError(msg)
@@ -1726,6 +1728,7 @@ def __init__(self, ax, onselect, drawtype='patch',
17261728
if rectprops is None:
17271729
rectprops = dict(facecolor='red', edgecolor='black',
17281730
alpha=0.2, fill=True)
1731+
rectprops['animated'] = useblit
17291732
self.rectprops = rectprops
17301733
self.to_draw = self._shape_klass((0, 0),
17311734
0, 1, visible=False, **self.rectprops)
@@ -1734,6 +1737,7 @@ def __init__(self, ax, onselect, drawtype='patch',
17341737
if lineprops is None:
17351738
lineprops = dict(color='black', linestyle='-',
17361739
linewidth=2, alpha=0.5)
1740+
lineprops['animated'] = useblit
17371741
self.lineprops = lineprops
17381742
self.to_draw = Line2D([0, 0, 0, 0, 0], [0, 0, 0, 0, 0], visible=False,
17391743
**self.lineprops)
@@ -1954,8 +1958,7 @@ def extents(self, extents):
19541958
self._edge_handles.set_data(*self.edge_centers)
19551959
self._center_handle.set_data(*self.center)
19561960
self.set_visible(self.visible)
1957-
1958-
self.canvas.draw_idle()
1961+
self.update()
19591962

19601963
def draw_shape(self, extents):
19611964
x0, x1, y0, y1 = extents

0 commit comments

Comments
 (0)