@@ -59,7 +59,6 @@ def __init__( self, figure ):
59
59
self .drawRect = False
60
60
self .rect = []
61
61
self .blitbox = None
62
- self .replot = True
63
62
self .setAttribute (QtCore .Qt .WA_OpaquePaintEvent )
64
63
65
64
def drawRectangle ( self , rect ):
@@ -69,7 +68,7 @@ def drawRectangle( self, rect ):
69
68
70
69
def paintEvent ( self , e ):
71
70
"""
72
- Draw to the Agg backend and then copy the image to the qt.drawable.
71
+ Copy the image from the Agg canvas to the qt.drawable.
73
72
In Qt, all drawing should be done inside of here when a widget is
74
73
shown onscreen.
75
74
"""
@@ -78,10 +77,6 @@ def paintEvent( self, e ):
78
77
if DEBUG : print 'FigureCanvasQtAgg.paintEvent: ' , self , \
79
78
self .get_width_height ()
80
79
81
- if self .replot :
82
- FigureCanvasAgg .draw (self )
83
- self .replot = False
84
-
85
80
if self .blitbox is None :
86
81
# matplotlib is in rgba byte order. QImage wants to put the bytes
87
82
# into argb format and is in a 4 byte unsigned int. Little endian
@@ -121,11 +116,13 @@ def paintEvent( self, e ):
121
116
122
117
def draw ( self ):
123
118
"""
124
- Draw the figure when xwindows is ready for the update
119
+ Draw the figure with Agg, and queue a request
120
+ for a Qt draw.
125
121
"""
126
-
127
- if DEBUG : print "FigureCanvasQtAgg.draw" , self
128
- self .replot = True
122
+ # The Agg draw is done here; delaying it until the paintEvent
123
+ # causes problems with code that uses the result of the
124
+ # draw() to update plot elements.
125
+ FigureCanvasAgg .draw (self )
129
126
self .update ()
130
127
131
128
def blit (self , bbox = None ):
0 commit comments