next up previous contents index
Next: The !listfuncs Command: List Up: Scripts Previous: The !tcl Command: Execute   Contents   Index


The !tk Command: Execute Tcl/Tk Script

Syntax: !tk scriptfile args ...
This command is available only if the Tcl/Tk plug-in has been loaded, and is not available under Microsoft Windows.

This command will execute a Tcl/Tk script (see 2.13), contained in the file given as an argument. Command arguments can be referenced in the script using the standard argc, argv mechanism. The language syntax is provided in documentation supplied with Tcl/Tk, and is described in several books. Much information can be found on the internet.

The scriptfile must have a .tcl or .tk extension, appropriate for the file contents. The Tk language is a superset of Tcl, containing a graphical interface. The files are executed differently: Tk files are executed in an event loop and a default window will be created, and execution will continue until all created windows are destroyed. Tcl files are interpreted linearly, with no graphics.

An example Tk script named ``tkdemo.tk'' is provided with the examples and can be used to set up and test the Tk execution facility.


next up previous contents index
Next: The !listfuncs Command: List Up: Scripts Previous: The !tcl Command: Execute   Contents   Index
Stephen R. Whiteley 2022-05-28