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

Skip to content

Commit f7486e7

Browse files
souravsinghQuLogic
authored andcommitted
Fix figure window icon (matplotlib#11165)
* Update _backend_tk.py * Fix problems with windowing * MNT: restore context manager
1 parent 5211ed8 commit f7486e7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/backends/_backend_tk.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,14 +1008,14 @@ def new_figure_manager_given_figure(cls, num, figure):
10081008
window.withdraw()
10091009

10101010
# Put a mpl icon on the window rather than the default tk icon.
1011-
# Tkinter doesn't allow colour icons on linux systems, but tk>=8.5 has
1012-
# a iconphoto command which we call directly. Source:
1011+
# Tkinter doesn't allow colour icons on linux systems, but tk>=8.5
1012+
# has a iconphoto command which we call directly. Source:
10131013
# http://mail.python.org/pipermail/tkinter-discuss/2006-November/000954.html
10141014
icon_fname = os.path.join(
10151015
rcParams['datapath'], 'images', 'matplotlib.ppm')
1016-
icon_img = Tk.PhotoImage(file=icon_fname)
1016+
icon_img = Tk.PhotoImage(file=icon_fname, master=window)
10171017
try:
1018-
window.tk.call('wm', 'iconphoto', window._w, icon_img)
1018+
window.iconphoto(False, icon_img)
10191019
except Exception as exc:
10201020
# log the failure (due e.g. to Tk version), but carry on
10211021
_log.info('Could not load matplotlib icon: %s', exc)

0 commit comments

Comments
 (0)