When using the Tkinter module in Python, the phenomenon that the button characters are not displayed occurred. After investigating, it seems to be a bug in Tkinter 8.5. This bug can be fixed by updating Tkinter, but at this time (December 9, 2019) there is no official way to update Tkinter. Several sites have shown how to update Tkinter, which was to reinstall Python. But I still couldn't update Tkinter in my environment.
However, I was able to update Tkinter to 8.6 by using a program created by volunteers from overseas, so I will introduce it here.
MacOS Mojave 10.14.6 Python3.8.4
I reinstall Python to update Tkinter, but this method only installs Python 3.8.4.
If you don't have Xcode installed, install the Xcode command line tools.
$ xcode-select --install
$ brew update
Uninstall all Python and Tkinter from the installed packages such as homebrew and pyenv.
Uninstall Python
$ brew uninstall python
$ pyenv uninstall x.x.x
→ x is the version number.
Uninstall Tkinter
$ brew uninstall tcl-tk
Delete unnecessary cache
$ brew cleanup
MacOS homebrew python 3.7.4 with tcl-tk (properly)
Download "python-with-tcl.rb" from the above site.
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/python.rb Delete or put it somewhere else.
Rename the downloaded "python-with-tcl.rb" to "python.rb" /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/ Put in.
Install Python using the command below.
$ HOMEBREW_NO_AUTO_UPDATE=1 brew install --build-from-source python
$ python -c "import tkinter;print(tkinter.TkVersion)"
It should be 8.6.
How to clean your Mac with brew cleanup to free up storage space MacOS homebrew python 3.7.4 with tcl-tk (properly) Cannot display png properly with tkinter8.5 on Mac → Upgraded tcl-tk by reinstalling Python of Pyenv
Recommended Posts