ENH: Handle redraw edge case.

You can call redraw before the first draw event so that the background never gets saved. In this case, skip blitting so we don't need the background image.
This commit is contained in:
Tony S Yu
2012-12-13 19:11:08 -05:00
parent 8e4f24af00
commit e98476ea41
+2 -1
View File
@@ -23,6 +23,7 @@ class CanvasToolBase(object):
useblit=True):
self.ax = ax
self.canvas = ax.figure.canvas
self.img_background = None
self.cids = []
self._artists = []
self.active = True
@@ -76,7 +77,7 @@ class CanvasToolBase(object):
This method should be called by subclasses when artists are updated.
"""
if self.useblit:
if self.useblit and self.img_background is not None:
self.canvas.restore_region(self.img_background)
self._draw_artists()
self.canvas.blit(self.ax.bbox)