Opened 15 months ago
Last modified 9 months ago
#71996 assigned defect
py-tkinter: Links with whichever tk variant was active at build time
| Reported by: | luillo76 | Owned by: | jmroot (Joshua Root) |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | |
| Keywords: | Cc: | chrstphrchvz (Christopher Chavez) | |
| Port: | py-tkinter |
Description
Unexpected behavior occurs with Python 3.13: the tk port with the +x11 variant opens using Quartz instead of X11.
This issue can be reproduced by running the following code in the Python console:
import tkinter tkinter.Tk()
Previous Python versions (3.12 and earlier) are not affected.
This is the list of tk-related ports active in my setup:
$ > port echo active | grep tk py39-matplotlib @3.9.4_0+tkinter py39-tkinter @3.9.21_0 py312-matplotlib @3.10.0_0+tkinter py312-tkinter @3.12.8_0 py313-matplotlib @3.10.0_0+tkinter py313-tkinter @3.13.1_0 tk @8.6.16_0+x11 tk-quartz @8.6.16_0 tk-x11 @8.6.16_0 tkdiff @4.2_0
Thank you.
Change History (3)
comment:1 Changed 15 months ago by ryandesign (Ryan Carsten Schmidt)
| Keywords: | +x11 removed |
|---|---|
| Owner: | set to jmroot |
| Port: | py-tkinter added; tk removed |
| Status: | new → assigned |
| Summary: | tk +x11 Not Working as Expected in Python 3.13 → py-tkinter: Links with whichever tk variant was active at build time |
comment:2 Changed 15 months ago by ryandesign (Ryan Carsten Schmidt)
Replying to luillo76:
Previous Python versions (3.12 and earlier) are not affected.
They are if they are rebuilt from source.
The separation of tk into tk-x11 and tk-quartz ports happened on January 5. In fact all python versions of py-tkinter were last modified before then, so the binaries we produced on the server still link with /opt/local/lib/libtk8.6.dylib, a symlink pointing to whichever tk library is currently active. So instead of having py-tkinter offer variants, it should be possible to tell it to link with the symlink, probably by using install_name_tool to fix the reference after linking.
comment:3 Changed 9 months ago by chrstphrchvz (Christopher Chavez)
| Cc: | chrstphrchvz added |
|---|

It depends on which variant of the tk port was active at the time that py313-tkinter was built. If you received a binary of py313-tkinter from our server, it was built with tk +quartz.
To work around the problem, when you have tk installed with the desired variant, rebuild py313-tkinter from source, e.g.:
I suspect we will want to change the py-tkinter port to have x11 and quartz variants and to depend directly on the tk-x11 and tk-quartz subports.