next up previous contents index
Next: Using Glish Up: Glish/Tk Previous: Canvas

Version Number and Utility Functions

    The information about which version of Tk is currently being used can be obtained from the system record, e.g. :

    print "tk version:",,
would print something like:
    tk version: 4.0 [rivet=0.0, tcl=7.4]

Finally, there are a couple of utility functions which can be of use.

  have_gui   is used to check to see if a graphical output device is available. It returns T if such a device is available and the Tk widgets can be used. Otherwise, it returns F.

    tk_hold and tk_release     are typically not needed, but sometimes when a large number of widget creation/deletion operations are done, the GUI may go through contortions. This is due to intermediate operations being processed and reflected in the GUI before the group of operations has finished. tk_hold and tk_release can often be used to take care of this problem. A call to tk_hold prevents any Tk operations from being processed until tk_release is called.

It is important that calls to tk_hold be balanced with an equal number of calles to tk_release. Otherwise, the GUI can freeze preventing any further interaction.


Thu Nov 13 16:44:05 EST 1997