views:

44

answers:

2

Hi guys, I apologize if this has been asked but does Tkinter work in Python 2.6.6 when installed with Mac Ports? Or do I need to pass the no_tkinter variant?

Thanks for any help!

A: 

pytkinter 2.4.6 is the latest version available on macports and works with python 2.4

pyfunc
They have py25-tkinter which is a stub. Tkinter is now built with python25. So I guess then there is no Tkinter support for 2.6.6 with Mac Ports?
gsieranski
Yeah missed that stub. But I have not seen Tkinter support for 2.6.6 in Mac Ports
pyfunc
For Python 2.6, 2.7, and 3.x ports, MacPorts includes Tkinter/tkinter in the base `pythonx.x` port. But see my answer for issues with it.
Ned Deily
+1  A: 

As of MacPorts python26 @2.6.6_0 and tk @8.5.8_0, Tkinter appears to only work if you don't mind using an X11-based Tk. There is a +quartz variant for the Tk port which does not require X11 but it is not yet supported in 64-bit mode, the preferred build and execution architecture on OS X 10.6, and at the moment it seems to not work in 32-bit mode either (tk @8.5.8_0). If you don't mind having MacPorts pull in a bunch of X11 client build dependencies and using X11 for Tkinter applications, the default variant looks like it works OK (lightly tested with OS X 10.6.4 and python26 @2.6.6_0). This applies to IDLE as well, since it uses Tkinter. Otherwise, stick to +no_tkinter if you can live without Tkinter and IDLE.

By the way, the Python 2.6.6 installed by the python.org installer (32-bit only) uses either the Apple-supplied Quartz Tk 8.4 for OS X 10.4 through 10.6 or it will use an ActiveState Tcl/Tk 8.4 if you have installed it. MacPorts currently has no provision for using either of them.

Ned Deily
Being new to Macports if this does get resolved do I need to reinstall python 2.6 or is there a way to remove the +no_tkinter variant?
gsieranski
Once it gets fixed, you'll need to reinstall the python26 port: `sudo port selfupdate ; sudo port install tk +quartz ; sudo port upgrade --enforce-variants python26 -no_tkinter`
Ned Deily