Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/matplotlib/backends/backend_qt5agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def __init__(self, figure):
self._agg_draw_pending = False
self._bbox_queue = []
self._drawRect = None
# used to keep track if there has been a whole-canvas
# render since the last paint event (which moves the
# pixels to the screen)
self.__full_redraw = True

def drawRectangle(self, rect):
if rect is not None:
Expand All @@ -63,13 +67,14 @@ def paintEvent(self, e):

painter = QtGui.QPainter(self)

if self._bbox_queue:
if not self.__full_redraw and self._bbox_queue:
bbox_queue = self._bbox_queue
else:
painter.eraseRect(self.rect())
bbox_queue = [
Bbox([[0, 0], [self.renderer.width, self.renderer.height]])]
self._bbox_queue = []
self.__full_redraw = False
for bbox in bbox_queue:
l, b, r, t = map(int, bbox.extents)
w = r - l
Expand Down Expand Up @@ -103,6 +108,9 @@ def draw(self):
# The Agg draw is done here; delaying causes problems with code that
# uses the result of the draw() to update plot elements.
super(FigureCanvasQTAggBase, self).draw()
# flip this bit so in the paint event we know to ignore any
# blit requests
self.__full_redraw = True
self.update()

def draw_idle(self):
Expand Down