5
votes

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 !

2
Did you try to compile your macports Tk with +quartz to use the native OS X graphics instead of X11? - schlenk
No ... I just did something like : port install tk - jean
Well that adds the default tk for macports, which is the X11 version. Try the +aqua version (or even better the Cocoa version, but not sure its already available in macports). - schlenk
Thanks schlenk. I tried with +quartz (did not find any +aqua variant). X11 is no more required but I encountered a problem with tcl : TclMacOSXNotifierAddRunLoopMode: Tcl not built with CoreFoundation support I did not find any tcl variant to get a Tcl version with CoreFoundation support. May be, fink would be a better alternative ? - jean

2 Answers

1
votes

This is a known problem, you can check this page to sove it https://www.python.org/download/mac/tcltk

1
votes

The tkinter ports depend on tk, but the tk port uses the x11 variant by default. Solved by installing the quartz variant instead. (Remove tkinter and tk port first, then install tk quartz variant using command below, then install tkinter again)

sudo port install tk -x11 +quartz

  • -x11 disables the default x11 variant
  • +quartz enables the quartz variant

More info on variants: https://guide.macports.org/#using.variants