@@ -517,8 +517,8 @@ class NavigationToolbar2Tk(NavigationToolbar2, tk.Frame):
517
517
"""
518
518
def __init__ (self , canvas , window ):
519
519
self .canvas = canvas
520
- # Avoid using self.window (prefer self.canvas.manager.window), so that
521
- # Tool implementations can reuse the methods.
520
+ # Avoid using self.window (prefer self.canvas.get_tk_widget().master),
521
+ # so that Tool implementations can reuse the methods.
522
522
self .window = window
523
523
NavigationToolbar2 .__init__ (self , canvas )
524
524
@@ -543,7 +543,7 @@ def release(self, event):
543
543
del self .lastrect
544
544
545
545
def set_cursor (self , cursor ):
546
- window = self .canvas .manager . window
546
+ window = self .canvas .get_tk_widget (). master
547
547
window .configure (cursor = cursord [cursor ])
548
548
window .update_idletasks ()
549
549
@@ -617,7 +617,7 @@ def save_figure(self, *args):
617
617
initialdir = os .path .expanduser (rcParams ['savefig.directory' ])
618
618
initialfile = self .canvas .get_default_filename ()
619
619
fname = tkinter .filedialog .asksaveasfilename (
620
- master = self .canvas .manager . window ,
620
+ master = self .canvas .get_tk_widget (). master ,
621
621
title = 'Save the figure' ,
622
622
filetypes = tk_filetypes ,
623
623
defaultextension = defaultextension ,
0 commit comments