The Tix (Tk Interface Extension) module provides an additional rich set of widgets. Although the standard Tk library has many useful widgets, they are far from complete. The Tix library provides most of the commonly needed widgets that are missing from standard Tk: HList, ComboBox, Control (a.k.a. SpinBox) and an assortment of scrollable widgets. Tix also includes many more widgets that are generally useful in a wide range of applications: NoteBook, FileEntry, PanedWindow, etc; there are more than 40 of them.
With all these new widgets, you can introduce new interaction techniques into applications, creating more useful and more intuitive user interfaces. You can design your application by choosing the most appropriate widgets to match the special needs of your application and users.
Note
Tix has been renamed to tkinter.tix in Python 3.0. The 2to3 tool will automatically adapt imports when converting your sources to 3.0.
See also
Toplevel widget of Tix which represents mostly the main window of an application. It has an associated Tcl interpreter.
Classes in the Tix module subclasses 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]
Tix introduces over 40 widget classes to the Tkinter repertoire. There is a demo of all the Tix widgets in the Demo/tix directory of the standard distribution.
The Tix module adds:
The tix commands provide access to miscellaneous elements of Tix‘s internal state and the Tix application context. Most of the information manipulated by these methods pertains to the application as a whole, or to a screen or display, rather than to a particular window.
To view the current settings, the common usage is:
import Tix
root = Tix.Tk()
print root.tix_configure()
Resets the scheme and fontset of the Tix application to newScheme and newFontSet, respectively. This affects only those widgets created after this call. Therefore, it is best to call the resetoptions method before the creation of any widgets in a Tix application.
The optional parameter newScmPrio can be given to reset the priority level of the Tk options set by the Tix schemes.
Because of the way Tk handles the X option database, after Tix has been has imported and inited, it is not possible to reset the color schemes and font sets using the tix_config() method. Instead, the tix_resetoptions() method must be used.