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

Skip to content

Commit 513637b

Browse files
committed
Merge pull request matplotlib#2449 from tacaswell/qt4_clear_before_draw
Qt4 clear before draw
2 parents e85f1c3 + 1cc671b commit 513637b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/matplotlib/backends/backend_qt4agg.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,16 @@ def paintEvent( self, e ):
102102

103103
refcnt = sys.getrefcount(stringBuffer)
104104

105+
# convert the Agg rendered image -> qImage
105106
qImage = QtGui.QImage(stringBuffer, self.renderer.width,
106107
self.renderer.height,
107108
QtGui.QImage.Format_ARGB32)
109+
# get the rectangle for the image
110+
rect = qImage.rect()
108111
p = QtGui.QPainter(self)
112+
# reset the image area of the canvas to be the back-ground color
113+
p.eraseRect(rect)
114+
# draw the rendered image on to the canvas
109115
p.drawPixmap(QtCore.QPoint(0, 0), QtGui.QPixmap.fromImage(qImage))
110116

111117
# draw the zoom rectangle to the QPainter

0 commit comments

Comments
 (0)