@@ -68,8 +68,7 @@ def __init__(self, figure):
6868 print ('FigureCanvasQtAgg: ' , figure )
6969 FigureCanvasQT .__init__ (self , figure )
7070 FigureCanvasAgg .__init__ (self , figure )
71- self .drawRect = False
72- self .rect = []
71+ self ._drawRect = None
7372 self .blitbox = None
7473 self .setAttribute (QtCore .Qt .WA_OpaquePaintEvent )
7574 # it has been reported that Qt is semi-broken in a windows
@@ -90,8 +89,7 @@ def __init__(self, figure):
9089 self ._priv_update = self .update
9190
9291 def drawRectangle (self , rect ):
93- self .rect = rect
94- self .drawRect = True
92+ self ._drawRect = rect
9593 self .repaint ()
9694
9795 def paintEvent (self , e ):
@@ -131,10 +129,10 @@ def paintEvent(self, e):
131129 p .drawPixmap (QtCore .QPoint (0 , 0 ), QtGui .QPixmap .fromImage (qImage ))
132130
133131 # draw the zoom rectangle to the QPainter
134- if self .drawRect :
132+ if self ._drawRect is not None :
135133 p .setPen (QtGui .QPen (QtCore .Qt .black , 1 , QtCore .Qt .DotLine ))
136- p . drawRect ( self . rect [ 0 ], self .rect [ 1 ],
137- self . rect [ 2 ], self . rect [ 3 ] )
134+ x , y , w , h = self ._drawRect
135+ p . drawRect ( x , y , w , h )
138136 p .end ()
139137
140138 # This works around a bug in PySide 1.1.2 on Python 3.x,
@@ -159,7 +157,7 @@ def paintEvent(self, e):
159157 p .drawPixmap (QtCore .QPoint (l , self .renderer .height - t ), pixmap )
160158 p .end ()
161159 self .blitbox = None
162- self .drawRect = False
160+ self ._drawRect = None
163161
164162 def draw (self ):
165163 """
0 commit comments