Friday, July 10, 2009

Ubuntu Jaunty (9.04) Python Tix fix

The "tix" (Tk Interface eXtension) version that Ubuntu Jaunty ships is broken for python (2.x and 3.x; stock and custom). If you run the tix demo applications, most of them will fail with something like: _tkinter.TclError: unknown color name "{#c3c3c3}"

The solution I came up for now was to compile and install tix manually, which solved the problem. Here is how it goes.

  1. Download the newest tix sources from here and extract them % tar -xvzf Tix8.4.3-src.tar.gz; cd Tix8.4.3
  2. Install tcl and tk 8.4 packages % sudo aptitude install tclx8.4 tclx8.4-dev tk8.4 tk8.4-dev (Note: Ubuntu ships with newer version - 8.5 which tix does not understand).
  3. Configure the tix sources % ./configure --with-tclconfig=/usr/share/tcltk/tcl8.4 --with-tkconfig=/usr/share/tcltk/tk8.4 (Note: if you do not specify the options than the config script will complain and die. Set the prefix option if you don't want it installed at /usr/lib/Tix8.4. Check ./configure --help if unsure)
  4. Compile the sources: % make
  5. Test the compiled sources: % make test (at the end there should be a number of Passed tests and 0 Failed - if something failed then you have to search for the problem).
  6. Install the thing: % sudo make install
Now the tix examples should work fine. Alternatively you can also use this handy shell script:
#! /bin/bash
wget -c
tar -xvzf Tix8.4.3-src.tar.gz
cd Tix8.4.3
sudo aptitude install tclx8.4 tclx8.4-dev tk8.4 tk8.4-dev
./configure --with-tclconfig=/usr/share/tcltk/tcl8.4 --with-tkconfig=/usr/share/tcltk/tk8.4
make test && sudo make install || echo "Test failed, check output.."

Note: the default installation target is /usr/lib/Tix8.4.3/, so removing the thing consists of % sudo rm -rvf /usr/lib/Tix8.4.3

The Launchpad bug report for the bug can be found here.

1 comment:

  1. hi
    I tried this.The make test runs successfully and still when I try to use Tix widgets(FileSelectBox) I am now getting segmentation fault!

    I upgraded my os to karmic ..but the issue is still unresolved