Housekeeping functions

Here we will described the functions that don’t fit into any of the above categories and are essentially housekeeping functions.

There is a predicate that returns a reference to the main window of a Tcl/Tk interpreter:

tk_main_window(+TclInterpreter, -TkWindow)

which given a reference to a Tcl interpreter Tclnterpreter, returns a reference to its main window in TkWindow.

The window reference can then be used in tk_destroy_window/1:


which destroys the window or widget referenced by TkWindow and all of its sub-widgets.

The predicate tk_make_window_exist/1 also takes a window reference:


which causes the window referenced by TkWindow in the Tcl interpreter TclInterpreter to be immediately mapped to the display. This is useful because normally Tk delays displaying new information for a long as possible (waiting until the machine is idle, for example), but using this call causes Tk to display the window immediately.

There is a predicate for determining how many main windows, and hence Tcl/Tk interpreters (excluding simple Tcl interpreters), are currently in use:


which returns an integer in the variable NumberOfWindows.

Send feedback on this subject.