Idk if anyone else is still stuck with this, this post solved my problem.
Basically it's the pyenv
grabbing the wrong version of tkinter (tcl-tk)
when installing python, if tcl-tk
hasn't been installed with brew
beforehand.
Here are the commands:
The commands below are exactly the same as the aforementioned post, but I've modified each comment to try to make them more newbie-friendly.
Uninstall both,
$ brew uninstall tcl-tk
uninstall tcl-tk with homebrew
$ pyenv uninstall 3.10.4
uninstall current python in pyenv. the last part is the current version of your python, which can be checked with python --version
then reinstall with correct order,
$ brew install tcl-tk
reinstall tcl-tk, version shouldn't need to be specified
$ pyenv install 3.10.4
reinstall Python with pyenv
$ pyenv global 3.10.4
set as global Python version
this problem should go away.
Some side notes:
- You definitely want to use
pyenv
or other tools to setup a virtual environment for python, further readings can be seen here.
- Sure, this is a "dark mode" problem, but there isn't a button you can toggle to resolve the situation. As other answers suggested, it's a version conflict and can only be solved by getting the versions right on a Mac (mine is 2022 M1 Mac).
- Tk-tcl is a shell-based language, and Tkinter is a wrapper around tk-tcl to make it work in python, and is largely preinstalled in python by default nowadays. Further readings of tkinter can be found here.