Bug summary
I was trying to debug #22822 and an unrelated error pops up in _set_image_for_button when moving a window between monitors of different DPIs. It is a Tcl error that pops up during the _update_window_dpi callback and is therefore printed without ending the program.
Code for reproduction
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('tkagg')
fig, ax = plt.subplots(1,1)
plt.show()
Actual outcome
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\richa\miniconda3\envs\mpl-dev\lib\tkinter\__init__.py", line 1921, in __call__
return self.func(*args)
File "c:\users\richa\documents\github\matplotlib\lib\matplotlib\backends\_backend_tk.py", line 438, in _update_window_dpi
self.toolbar._rescale()
File "c:\users\richa\documents\github\matplotlib\lib\matplotlib\backends\_backend_tk.py", line 574, in _rescale
NavigationToolbar2Tk._set_image_for_button(self, widget)
File "c:\users\richa\documents\github\matplotlib\lib\matplotlib\backends\_backend_tk.py", line 674, in _set_image_for_button
button.configure(image=image)
File "C:\Users\richa\miniconda3\envs\mpl-dev\lib\tkinter\__init__.py", line 1675, in configure
return self._configure('configure', cnf, kw)
File "C:\Users\richa\miniconda3\envs\mpl-dev\lib\tkinter\__init__.py", line 1665, in _configure
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: image "pyimage10" doesn't exist
Also because the callback is interrupted, some widgets are not rescaled.
Expected outcome
no traceback and properly scaled widgets
Additional information
This code was introduced in #22163 to improve the Tk toolbar buttons in dark mode situations. I don't immediately see the cause, but it seems very easy for me to trigger so I'm surprised nobody noticed? attn: @daniilS
Operating system
Windows
Matplotlib Version
main back to ff60b28 (bisected)
Matplotlib Backend
tkagg
Python version
3.10.4
Jupyter version
No response
Installation
git checkout
Bug summary
I was trying to debug #22822 and an unrelated error pops up in
_set_image_for_buttonwhen moving a window between monitors of different DPIs. It is a Tcl error that pops up during the_update_window_dpicallback and is therefore printed without ending the program.Code for reproduction
Actual outcome
Also because the callback is interrupted, some widgets are not rescaled.
Expected outcome
no traceback and properly scaled widgets
Additional information
This code was introduced in #22163 to improve the Tk toolbar buttons in dark mode situations. I don't immediately see the cause, but it seems very easy for me to trigger so I'm surprised nobody noticed? attn: @daniilS
Operating system
Windows
Matplotlib Version
main back to ff60b28 (bisected)
Matplotlib Backend
tkagg
Python version
3.10.4
Jupyter version
No response
Installation
git checkout