3636_decref .argtypes = [ctypes .py_object ]
3737_decref .restype = None
3838
39+
3940def new_figure_manager (num , * args , ** kwargs ):
4041 """
4142 Create a new figure manager instance
@@ -46,13 +47,15 @@ def new_figure_manager(num, *args, **kwargs):
4647 thisFig = FigureClass (* args , ** kwargs )
4748 return new_figure_manager_given_figure (num , thisFig )
4849
50+
4951def new_figure_manager_given_figure (num , figure ):
5052 """
5153 Create a new figure manager instance for the given figure.
5254 """
5355 canvas = FigureCanvasQTAgg (figure )
5456 return FigureManagerQT (canvas , num )
5557
58+
5659class FigureCanvasQTAggBase (object ):
5760 """
5861 The canvas the figure renders into. Calls the draw and print fig
@@ -62,7 +65,7 @@ class FigureCanvasQTAggBase(object):
6265
6366 figure - A Figure instance
6467 """
65-
68+
6669 def drawRectangle (self , rect ):
6770 self ._drawRect = rect
6871 self .repaint ()
@@ -74,7 +77,7 @@ def paintEvent(self, e):
7477 shown onscreen.
7578 """
7679
77- #FigureCanvasQT.paintEvent(self, e)
80+ # FigureCanvasQT.paintEvent(self, e)
7881 if DEBUG :
7982 print ('FigureCanvasQtAgg.paintEvent: ' , self ,
8083 self .get_width_height ())
@@ -157,12 +160,14 @@ def blit(self, bbox=None):
157160 def print_figure (self , * args , ** kwargs ):
158161 FigureCanvasAgg .print_figure (self , * args , ** kwargs )
159162 self .draw ()
160-
161- class FigureCanvasQTAgg (FigureCanvasQTAggBase , FigureCanvasQT , FigureCanvasAgg ):
163+
164+
165+ class FigureCanvasQTAgg (FigureCanvasQTAggBase ,
166+ FigureCanvasQT , FigureCanvasAgg ):
162167 """
163168 The canvas the figure renders into. Calls the draw and print fig
164- methods, creates the renderers, etc.
165-
169+ methods, creates the renderers, etc.
170+
166171 Modified to import from Qt5 backend for new-style mouse events.
167172
168173 Public attribute
@@ -194,7 +199,8 @@ def __init__(self, figure):
194199 self ._priv_update = self .repaint
195200 else :
196201 self ._priv_update = self .update
197-
202+
203+
198204class NavigationToolbar2QTAgg (NavigationToolbar2QT ):
199205 def __init__ (* args , ** kwargs ):
200206 warnings .warn ('This class has been deprecated in 1.4 ' +
@@ -205,6 +211,5 @@ def __init__(*args, **kwargs):
205211 NavigationToolbar2QT .__init__ (* args , ** kwargs )
206212
207213
208-
209214FigureCanvas = FigureCanvasQTAgg
210215FigureManager = FigureManagerQT
0 commit comments