Name

ensemble

ensemble name command args...

Create or modify an ensemble command (i.e., a command such as info, which is a composite of many different functions). If an ensemble command name already exists, then it is updated; otherwise, a new command is created.

The command accepts zero or more command arguments that take one of two forms. The part command defines a new part for the ensemble, adding it as a new option to the command. The argument list and body are defined as for the proc command. The command parameter can also be ensemble, allowing another subensemble to be nested.

Example

ensemble wait {
        part variable {name} {
          uplevel vwait $name
        }
        part visibility {name} {
          tkwait visibility $name
        }
        part window {name} {
          tkwait window $name
        }
}

Get Tcl/Tk in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.