From e98476ea41bf41686f92fb7846c0b2160e286e40 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Thu, 13 Dec 2012 19:11:08 -0500 Subject: [PATCH] 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. --- skimage/viewer/canvastools/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/skimage/viewer/canvastools/base.py b/skimage/viewer/canvastools/base.py index 37329d6a..3d179578 100644 --- a/skimage/viewer/canvastools/base.py +++ b/skimage/viewer/canvastools/base.py @@ -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)