Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Animation/Tcl/animation.tcl
Normal file
20
Task/Animation/Tcl/animation.tcl
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package require Tk
|
||||
set s "Hello World! "
|
||||
set dir 0
|
||||
# Periodic animation callback
|
||||
proc animate {} {
|
||||
global dir s
|
||||
if {$dir} {
|
||||
set s [string range $s 1 end][string index $s 0]
|
||||
} else {
|
||||
set s [string index $s end][string range $s 0 end-1]
|
||||
}
|
||||
# We will run this code ~8 times a second (== 125ms delay)
|
||||
after 125 animate
|
||||
}
|
||||
# Make the label (constant width font looks better)
|
||||
pack [label .l -textvariable s -font {Courier 14}]
|
||||
# Make a mouse click reverse the direction
|
||||
bind .l <Button-1> {set dir [expr {!$dir}]}
|
||||
# Start the animation
|
||||
animate
|
||||
Loading…
Add table
Add a link
Reference in a new issue