I have installed Python 2.7 and some useful libraries (like Python Image Library)
through MacPorts. Everything is OK.
Now, I want to use Tkinter.
The problem is that the version uses X11 (and I do not want to use X11).
If I switch to the python installed by Apple (/usr/bin/python instead of
/opt/local/bin/python), Tkinter is OK (no X11 required) but of
course, I missed the various libraries installed through MacPorts.
My question is : "How could I use the no X11 Tkinter with the Python 2.7 installed
through MacPorts" ?
Thanks in advance !
This is a known problem, you can check this page to sove it
https://www.python.org/download/mac/tcltk
Quartz is no longer shipped with OS X.
MacPorts don't ship Cocoa tkinter version. Even latest py36-tkinter depends on tk which depends on quartz or x11.
From The Python Tkinter Page (https://www.python.org/download/mac/tcltk):
How Python Chooses Which Tk Library To Use
64-bit/32-bit Mac OS X installers for Python 3.6.x, 3.5.x, and 2.7.x dynamically link to Tcl/Tk 8.5 frameworks.
32-bit-only Python installers for Mac OS X dynamically link to Tcl/Tk 8.4 frameworks.
[...] dynamic linker looks first in /Library/Frameworks for Tcl and Tk frameworks [...] then in /System/Library/Frameworks [...]
As of my test, this is not the behavior of MacPorts' Python.
So my solution was to install Python from python.org.