Run this command to test tkinter.
python3 -m tkinter -c "tkinter._test()"
On an M2 you'll probably see this
Fortunately this article provides a guide to fix this. Just enter the commands listed below. It assumes the presence of Homebrew on your machine. It will install the asdf version manager and installs the specified version of Python with tk bundled.
- brew install asdf
- brew install tcl-tk
- asdf uninstall python 3.11.5
- asdf reshim python
- PYTHON_CONFIGURE_OPTS="--with-tcltk-includes='$(pkg-config tk --cflags)' --with-tcltk-libs='$(pkg-config tk --libs)'"
- asdf install python 3.11.5
- asdf shell python 3.11.5 (per shell session) or
- asdf global python latest (more permanent, see
~/.tool-versions
)
When succesful, test again with python3 -m tkinter -c "tkinter._test()"
and hopefully this will be the result