Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4eba503

Browse filesBrowse files
efiringMeeseeksDev[bot]
authored andcommitted
Backport PR matplotlib#14568: Don't assume tk canvas have a manager attached.
1 parent ba79a57 commit 4eba503
Copy full SHA for 4eba503

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed

‎lib/matplotlib/backends/_backend_tk.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/_backend_tk.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,8 @@ class NavigationToolbar2Tk(NavigationToolbar2, tk.Frame):
587587
"""
588588
def __init__(self, canvas, window):
589589
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.
592592
self.window = window
593593
NavigationToolbar2.__init__(self, canvas)
594594

@@ -613,7 +613,7 @@ def release(self, event):
613613
del self.lastrect
614614

615615
def set_cursor(self, cursor):
616-
window = self.canvas.manager.window
616+
window = self.canvas.get_tk_widget().master
617617
window.configure(cursor=cursord[cursor])
618618
window.update_idletasks()
619619

@@ -688,7 +688,7 @@ def save_figure(self, *args):
688688
initialdir = os.path.expanduser(rcParams['savefig.directory'])
689689
initialfile = self.canvas.get_default_filename()
690690
fname = tkinter.filedialog.asksaveasfilename(
691-
master=self.canvas.manager.window,
691+
master=self.canvas.get_tk_widget().master,
692692
title='Save the figure',
693693
filetypes=tk_filetypes,
694694
defaultextension=defaultextension,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.