Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating tcl/tk version of Homebrew python3 on macOS

My environment:

macOS 10.13 python 3.7.1 from Homebrew

I'm having lots of Tcl/TK quirks on the stock Tcl/TK 8.5 under /System/Library/Frameworks/Tcl.framework/Versions/8.5/, and would like to upgrade my Tcl/TK.

But with this question I couldn't find any working tips for upgrading, including:

  • https://discussions.apple.com/thread/8066794

  • IDLE warns against an old TCL version even though I've installed a newer version

  • Why my Python installed via home brew not include Tkinter

  • How to change the tk version of your Python installation?

  • How do I link the ActiveState distribution of Tcl/Tk to HomeBrew installed Python

My test results

  1. --with-tcl-tk no longer works with the latest Homebrew. Running brew install python --with-tcl-tk still points to system Tcl/TK 8.5.9.
  2. The above is also tested with an uninstall/install cycle.
  3. Python keeps using system Tcl/TK after installing latest ActiveTcl.
like image 375
kakyo Avatar asked Jan 26 '23 23:01

kakyo


1 Answers

After many more failures, I concluded that the easiest way to make this work is to completely forget about Homebrew, uninstall its python packages.

Then install the latest ActiveTcl and then the python.org version instead. The python.org version will work on top of the latest "System" Tcl/TK, which will be refreshed after installing the ActiveTcl. Unfortunately, Homebrew ignores it.

The current 3.7.2 from python.org is compiled with Tcl/TK 8.6.8:

$ python3
Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter as tk
>>> print(tk.Tcl().eval('info patchlevel'))
8.6.8

After updating it, several bugs like checkbuttons showing wrong checkmarks on a menu disappeared.

like image 200
kakyo Avatar answered Jan 31 '23 08:01

kakyo