More Labels
More Labels
It's also possible to change the value of options for a widget
programmatically, after the widget has been created. You do this using
the label configure command. Thus, you can
write:
label .l -text hello
.l configure -bg red
This will behave just like if you had specified the -bg option
in the command to create the label.
Every Tk widget supports a configure command that knows about
the options supported by that type of widget.
Here's a more interesting example.
In the following Tclet, I'm using two widgets, a label and a
button (the blue one, marked
click!). When you click on the button, the
label's text is changed, using configure: