Skip to content

Commit

Permalink
ENH: Handle redraw edge case.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tonysyu committed Dec 14, 2012
1 parent 8e4f24a commit e98476e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion skimage/viewer/canvastools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(self, ax, on_move=None, on_enter=None, on_release=None,
useblit=True):
self.ax = ax
self.canvas = ax.figure.canvas
self.img_background = None
self.cids = []
self._artists = []
self.active = True
Expand Down Expand Up @@ -76,7 +77,7 @@ def redraw(self):
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)
Expand Down

0 comments on commit e98476e

Please sign in to comment.