O'Reilly logo

Practical Programming in Tcl & Tk, Third Edition by Brent B. Welch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring Attributes

You specify attributes for Tk widgets when you create them. You can also change them dynamically at any time after that. In both cases the syntax uses pairs of arguments. The first item in the pair identifies the attribute, the second provides the value. For example, a button can be created like this:

button .doit -text Doit -command DoSomething

The name of the button is .doit, and two attributes are specified: the text and the command. You can change the .doit button later with the configure widget operation:

.doit configure -text Stop -command StopIt

The current configuration of a widget can be queried with another form of the configure operation. If you just supply an attribute, the settings associated with that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required