jean
jean

Reputation: 251

Use no-X11 tkinter with python (installed through macports)

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 !

Upvotes: 5

Views: 3677

Answers (2)

vin047
vin047

Reputation: 320

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

Upvotes: 5

Walle Cyril
Walle Cyril

Reputation: 3247

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

Upvotes: 1

Related Questions