@@ -587,8 +587,8 @@ class NavigationToolbar2Tk(NavigationToolbar2, tk.Frame):
587
587
"""
588
588
def __init__ (self , canvas , window ):
589
589
self .canvas = canvas
590
- # Avoid using self.window (prefer self.canvas.manager.window), so that
591
- # Tool implementations can reuse the methods.
590
+ # Avoid using self.window (prefer self.canvas.get_tk_widget().master),
591
+ # so that Tool implementations can reuse the methods.
592
592
self .window = window
593
593
NavigationToolbar2 .__init__ (self , canvas )
594
594
@@ -613,7 +613,7 @@ def release(self, event):
613
613
del self .lastrect
614
614
615
615
def set_cursor (self , cursor ):
616
- window = self .canvas .manager . window
616
+ window = self .canvas .get_tk_widget (). master
617
617
window .configure (cursor = cursord [cursor ])
618
618
window .update_idletasks ()
619
619
@@ -688,7 +688,7 @@ def save_figure(self, *args):
688
688
initialdir = os .path .expanduser (rcParams ['savefig.directory' ])
689
689
initialfile = self .canvas .get_default_filename ()
690
690
fname = tkinter .filedialog .asksaveasfilename (
691
- master = self .canvas .manager . window ,
691
+ master = self .canvas .get_tk_widget (). master ,
692
692
title = 'Save the figure' ,
693
693
filetypes = tk_filetypes ,
694
694
defaultextension = defaultextension ,
0 commit comments