Artifact
5e4eacdc8675808a3f939d8e965a7bcca0a9899ab1a1545430c797b35d822fce:
Attachment "size-const-demo.tcl" to
ticket [23f52946]
added by
emiliano
2026-04-17 22:37:43.
package require Tk
proc animate {a} {
global aid
.lf.l configure -textangle [expr {$a}]
set aid [after 100 [list animate [expr {fmod($a+5, 360)}]]]
}
frame .lf -width 500 -height 300
label .lf.l \
-text "Hello\nworld" \
-anchor center \
-font {-size 16} \
-background yellow \
-relief raised
place .lf.l -relx 0.5 -rely 0.5 -anchor center
frame .cf
checkbutton .cf.cw -variable w -text "set width" -command {
.lf.l configure -width [expr {$w * $wval}]
}
spinbox .cf.sw -textvariable wval -from 2 -to 50 -command {
.lf.l configure -width [expr {$w * $wval}]
}
checkbutton .cf.ch -variable h -text "set height" -command {
.lf.l configure -height [expr {$h * $hval}]
}
spinbox .cf.sh -textvariable hval -from 1 -to 5 -command {
.lf.l configure -height [expr {$h * $hval}]
}
checkbutton .cf.ani -variable animate -text Animate -command {
if {$animate} {
animate 5
} else {
after cancel $aid
}
}
grid .cf.cw .cf.sw -sticky w
grid .cf.ch .cf.sh -sticky w
grid .cf.ani -sticky w
pack .lf .cf -side left
set animate 0
set wval 10
set hval 2