Next: tkerror, Previous: send, Up: Control [Contents]

### 3.19 tk

tk \- Manipulate Tk internal state

#### Synopsis

tk option ?arg arg ...?

#### Description

The tk command provides access to miscellaneous elements of Tk’s internal state. Most of the information manipulated by this command pertains to the application as a whole, or to a screen or display, rather than to a particular window. The command can take any of a number of different forms depending on the option argument. The legal forms are:

tk :colormodel window ?newValue?

  If newValue isn’t specified, this command returns the current color model in use for window’s screen, which will be either color or monochrome. If newValue is specified, then it must be either color or monochrome or an abbreviation of one of them; the color model for window’s screen is set to this value.

The color model is used by Tk and its widgets to determine whether it should display in black and white only or use colors. A single color model is shared by all of the windows managed by one process on a given screen. The color model for a screen is set initially by Tk to monochrome if the display has four or fewer bit planes and to color otherwise. The color model will automatically be changed from color to monochrome if Tk fails to allocate a color because all entries in the colormap were in use. An application can change its own color model at any time (e.g. it might change the model to monochrome in order to conserve colormap entries, or it might set the model to color to use color on a four-bit display in special circumstances), but an application is not allowed to change the color model to color unless the screen has at least two bit planes. .RE

#### Keywords

color model, internal state

Next: tkerror, Previous: send, Up: Control [Contents]