next up previous contents index
Next: Geometry handling Up: Tk Previous: Widget commands

Widget configuration

  As described above, all widget classes have a widget command named configure. This command gives the user access to the widget resources. Usually, widgets have resources like: foreground, background, font, etc.. To set a specific resource, the Tcl

command representing the widget is called, followed by the configure widget command. Then follows the resource name. Resource names begin with a ``-''. Behind the resource name, the new value is specified. If no new value is specified, the current value of the resource is returned.

Some widgets (like buttons) have resources that allow it to bind functionality to them. The resources have names like -command, -xscrollcommand etc.. These resources contain Tcl scripts which are evaluated when the command is activated (for example when a button is pressed).

 
		.b1 configure -foreground red

.b1 configure -command {puts stdout exit}



Harry Beker
Thu Feb 29 18:06:38 MET 1996