Skip to content

[Bug]: TkAgg backend is broken with tcl/tk 9.0 #29126

Closed
@PhysSong

Description

@PhysSong

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions