IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
20.2.1 Using Tix

20.2.1 Using Tix

class Tix( screenName[, baseName[, className]])
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]

See About this document... for information on suggesting changes.