2

This question is similar to this other question.

When I run the following code on Mac OS X (it runs fine on Windows):

import Tix 
root = Tix.Tk()

I get the following error message:

Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tix.py", line 221, in init self.tk.eval('package require Tix') _tkinter.TclError: can't find package Tix

The Python docs described the issue, but the answer below was not helpful in my case:

If this fails, you have a Tk installation problem which must be resolved before proceeding. Use the environment variable TIX_LIBRARY to point to the installed Tix library directory, and make sure you have the dynamic object library (tix8183.dll or libtix8183.so) in the same directory that contains your Tk dynamic object library (tk8183.dll or libtk8183.so). The directory with the dynamic object library should also have a file called pkgIndex.tcl (case sensitive), which contains the line:

package ifneeded Tix 8.1 [list load "[file join $dir tix8183.dll]" Tix]

If anyone has experienced this error and found a work-around, please fill me in.

Community
  • 1
  • 1
Mike
  • 301
  • 4
  • 7
  • If you are using Python 3.x (you didn't say) then this is the correct page https://docs.python.org/3.3/library/tkinter.tix.html –  Jan 03 '15 at 05:28
  • Thanks Curly Joe, it's the same information regardless. I don't think it's a python 2.x or 3.x issue rather a Tix issue. – Mike Jan 03 '15 at 05:50
  • In docs, right below installation testing code, there is a paragraph starts with `If this fails...` Have you tried those steps? – Lafexlos Jan 03 '15 at 08:49
  • Hi Lafexios, yes I tried it unfortunately it didn't work as those files didn't exist. The answer must've been written for older versions of Tix. Other people on the internet tried as well and failed. I'm looking for a solution where someone has encountered the same problem and found a work-around. – Mike Jan 03 '15 at 09:17
  • """Thanks Curly Joe, it's the same information regardless. I don't think it's a python 2.x or 3.x issue rather a Tix issue.""" -- It is not the same info; that is the point. Python 3.x imports differently. If you want some help, at least post the version of python being used=print(sys.version) –  Jan 03 '15 at 19:17
  • I believe you are referring to the following: import Tix --> from tkinter import tix from Tkconstants import * --> from tkinter.constants import * root = Tix.Tk() --> root = tix.Tk() I have considered the syntax for both python versions so I don't believe that's the problem. Rather It's more of an OS issue (Works fine on Windows but not on OSx and other seem to have problems on OSx). Please let me know if I missed anything else. – Mike Jan 03 '15 at 20:22
  • The current 'if this fails' paragraph is wrong even for Windows. I opened a cpython tracker issue, http://bugs.python.org/issue23156 to request the doc be updated with what people need to know *now*, not 20(?) years ago. Mike, if you are or become registered, you could join the issue and 'test' any proposed update for OSX, or add any info you discover otherwise. – Terry Jan Reedy Jan 03 '15 at 22:04
  • Thanks a lot Terry. Will do. – Mike Jan 07 '15 at 02:35
  • @Mike, I have done a [hacking](http://stackoverflow.com/a/29307885/841339) to run `Tix` in OSX 10.9.5. It may be some temporary solution until there is no decision about to port or not port `Tkinter` to `ttk`. – Mauro Baraldi Mar 28 '15 at 04:00
  • @Mauro Baraldi Thanks. Would you mind sharing? – Mike Mar 31 '15 at 00:58
  • @Mike I'm following the thread on bugs-python-list about this issue. I'm in touch with Ned Deily to work on it. Anyway, I'll document it on a blog and tag here ;-) – Mauro Baraldi Mar 31 '15 at 01:07

1 Answers1

3

Based on Terry's Inquiry to Python.org user group:

  1. If you're on Mac OSX 64-bit you're pretty much out of luck.

  2. If you happen to have a 32-bit running and have Tcl installed you can simply install Tix using teacup (it's similar to pip and it comes installed with Tcl)

    sudo teacup install Tix

  3. Tix is outdated (widget style and documentation maintenance) and better off using Ttk.

nbro
  • 15,395
  • 32
  • 113
  • 196
Mike
  • 301
  • 4
  • 7