activebackground activeforeground background font foreground
See the options manual entry for details on the standard options.
Name: flash Class: Flash Command-Line Switch: -flash Default value: 1
The die command creates a widget that represents the face of a die, and a new Tcl command whose name is pathname. The command is then used to invoke various methods of the widget. The command has the general form:
pathName option ?arg arg ... arg?
The die is implemented as a button. The default button action is to invoke the roll method.
The button action can be changed by configuring the -command option of the bdie component. (For example, pathName component bdie configure -command newCommand.) The die depiction is based on displayed characters for the button text. A larger or smaller die can be obtained by configuring a larger or smaller fixed pitch font for the widget.
package require Dmhwidgets
frame .dice
pack .dice -side top -expand 1 -fill both
dmhwidgets::die .dice.d1
dmhwidgets::die .dice.d2
pack .dice.d1 .dice.d2 -side left -expand 0 -padx 10 -pady 10
button .diceb -text Roll -command dice_roll -width 8
pack .diceb -side top -padx 12m -pady 4m
proc dice_roll {} {
.diceb configure -state disabled
set sum 0
foreach d [list .dice.d1 .dice.d2] {
incr sum [$d roll]
}
.diceb configure -state normal
return $sum
}