@@ -261,7 +261,7 @@ def __init__(self, canvas, num, window):
261261 w , h = int (w ), int (h )
262262 self .window .minsize (int (w * 3 / 4 ),int (h * 3 / 4 ))
263263 if matplotlib .rcParams ['toolbar' ]== 'classic' :
264- self .toolbar = NavigationToolbar ( canvas , self )
264+ self .toolbar = NavigationToolbar ( canvas , self . window )
265265 elif matplotlib .rcParams ['toolbar' ]== 'toolbar2' :
266266 self .toolbar = NavigationToolbar2TkAgg ( canvas , self .window )
267267 else :
@@ -380,14 +380,15 @@ def _Button(self, text, file, command):
380380 b .pack (side = Tk .LEFT )
381381 return b
382382
383- def __init__ (self , canvas , figman ):
383+ def __init__ (self , canvas , window ):
384+ self .canvas = canvas
385+ self .window = window
386+
384387 xmin , xmax = canvas .figure .bbox .intervalx ().get_bounds ()
385388 height , width = 50 , xmax - xmin
386- Tk .Frame .__init__ (self , master = figman .window ,
389+ Tk .Frame .__init__ (self , master = self .window ,
387390 width = width , height = height ,
388391 borderwidth = 2 )
389- self .canvas = canvas
390- self .figman = figman
391392
392393 self .update () # Make axes menu
393394
@@ -429,8 +430,6 @@ def __init__(self, canvas, figman):
429430
430431 self .pack (side = Tk .BOTTOM , fill = Tk .X )
431432
432- def close (self ):
433- Gcf .destroy (self .figman ._num )
434433
435434 def set_active (self , ind ):
436435 self ._ind = ind
@@ -444,7 +443,7 @@ def panx(self, arg):
444443 else : direction = - 1
445444 for a in self ._active :
446445 a .panx (direction )
447- self .figman . show ()
446+ self .canvas . draw ()
448447
449448 def pany (self , arg ):
450449 try : arg .direction
@@ -454,7 +453,7 @@ def pany(self, arg):
454453 else : direction = - 1
455454 for a in self ._active :
456455 a .pany (direction )
457- self .figman . show ()
456+ self .canvas . draw ()
458457
459458 def zoomx (self , arg ):
460459 try : arg .direction
@@ -465,7 +464,7 @@ def zoomx(self, arg):
465464
466465 for a in self ._active :
467466 a .zoomx (direction )
468- self .figman . show ()
467+ self .canvas . draw ()
469468
470469 def zoomy (self , arg ):
471470 try : arg .direction
@@ -476,10 +475,10 @@ def zoomy(self, arg):
476475
477476 for a in self ._active :
478477 a .zoomy (direction )
479- self .figman . show ()
478+ self .canvas . draw ()
480479
481480 def save_figure (self ):
482- fs = FileDialog .SaveFileDialog (master = self .figman . window ,
481+ fs = FileDialog .SaveFileDialog (master = self .window ,
483482 title = 'Save the figure' )
484483 try :
485484 self .lastDir
0 commit comments