Bug summary
When trying to use TkAgg backend with tkinter compiled with tcl/tk 9.0(ex. python-tk with Python 3.13 from Homebrew), the backend fails to load
Code for reproduction
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
Actual outcome
from . import _tkagg
ImportError: Failed to load Tcl_SetVar
Expected outcome
works as expected
Additional information
Tcl_SetVar function is removed in tcl 9.0, which is used in DpiSubclassProc of src/_tkagg.cpp on Windows. The function can easily be replaced with Tcl_SetVar2 if exists.
Operating system
macOS 14.6
Matplotlib Version
3.9.2
Matplotlib Backend
No response
Python version
3.13
Jupyter version
No response
Installation
pip
Bug summary
When trying to use TkAgg backend with tkinter compiled with tcl/tk 9.0(ex.
python-tkwith Python 3.13 from Homebrew), the backend fails to loadCode for reproduction
Actual outcome
Expected outcome
works as expected
Additional information
Tcl_SetVarfunction is removed in tcl 9.0, which is used inDpiSubclassProcofsrc/_tkagg.cppon Windows. The function can easily be replaced withTcl_SetVar2if exists.Operating system
macOS 14.6
Matplotlib Version
3.9.2
Matplotlib Backend
No response
Python version
3.13
Jupyter version
No response
Installation
pip