home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Practical Programming in Tcl & Tk (4th Edition)
/
TCLBOOK4.BIN
/
pc
/
exsource
/
30_1.tcl
< prev
next >
Wrap
Text File
|
2003-04-16
|
418b
|
24 lines
#
# Example 30-1
# A troublesome button command.
#
proc Trouble {args} {
set b 0
# Display the value of x, a global variable
label .label -textvariable x
set f [frame .buttons -borderwidth 10]
# Create buttons that multiply x by their value
foreach val $args {
button $f.$b -text $val \
-command "set x \[expr \$x * $val\]"
pack $f.$b -side left
incr b
}
pack .label $f
}
set x 1
Trouble -1 4 7 36