Next: Tix Widget Set Up: Introduction Previous: Installing Tix

 

Using Tix with Python

Classes in the Tix module subclass the classes in the Tkinter module. The former imports the latter, so to use Tix with Tkinter, all you need to do is to import one module. In general, you can just import Tix, and replace the toplevel call to Tkinter.Tk with Tix.Tk:

import Tix
from Tkconstants import *
root = Tix.Tk()

To use Tix, you must have the Tix widgets installed, usually alongside your installation of the Tk widgets. To test your installation, try the following:

import Tix
root = Tix.Tk()
root.tk.eval('package require Tix')

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]


http://tix.sourceforge.net