Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ddaaa0e

Browse files
committed
Parent tk StringVar to the canvas widget, not to the toolbar.
... because the toolbar may be a fake object (when using rcParams["toolbar"] = "toolmanager"). Try with `rcParams["toolbar"] = "toolmanager; use("tkagg")` and interactively saving the picture. No automated tests, sorry.
1 parent 2360c59 commit ddaaa0e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/backends/_backend_tk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ def save_figure(self, *args):
843843

844844
default_extension = self.canvas.get_default_filetype()
845845
default_filetype = self.canvas.get_supported_filetypes()[default_extension]
846-
filetype_variable = tk.StringVar(self, default_filetype)
846+
filetype_variable = tk.StringVar(self.canvas.get_tk_widget(), default_filetype)
847847

848848
# adding a default extension seems to break the
849849
# asksaveasfilename dialog when you choose various save types

0 commit comments

Comments
 (0)