@@ -73,6 +73,22 @@ def __init__( self, figure ):
73
73
self .rect = []
74
74
self .blitbox = None
75
75
self .setAttribute (QtCore .Qt .WA_OpaquePaintEvent )
76
+ # it has been reported that Qt is semi-broken in a windows
77
+ # environment. If `self.draw()` uses `update` to trigger a
78
+ # system-level window repaint (as is explicitly advised in the
79
+ # Qt documentation) the figure responds very slowly to mouse
80
+ # input. The work around is to directly use `repaint`
81
+ # (against the advice of the Qt documentation). The
82
+ # difference between `update` and repaint is that `update`
83
+ # schedules a `repaint` for the next time the system is idle,
84
+ # where as `repaint` repaints the window immediately. The
85
+ # risk is if `self.draw` gets called with in another `repaint`
86
+ # method there will be an infinite recursion. Thus, we only
87
+ # expose windows users to this risk.
88
+ if sys .platform .startswith ('win' ):
89
+ self ._priv_update = self .repaint
90
+ else :
91
+ self ._priv_update = self .update
76
92
77
93
def drawRectangle ( self , rect ):
78
94
self .rect = rect
@@ -152,7 +168,7 @@ def draw( self ):
152
168
# causes problems with code that uses the result of the
153
169
# draw() to update plot elements.
154
170
FigureCanvasAgg .draw (self )
155
- self .update ()
171
+ self ._priv_update ()
156
172
157
173
def blit (self , bbox = None ):
158
174
"""
0 commit comments