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