Canvas slider

Source code:


#---------------------------------------------------------------
# A text slide demo using the canvas widget
#  Freely distributable under the "Standard Tcl License"
#  See http://www.eolas.com/tcl/license.txt for details
#---------------------------------------------------------------


# --------------------------------------------------------------
# Examine each of the letters, create a text object and 
# move that object the length of the canvas. 
# --------------------------------------------------------------

proc slide { } {
global letter_list list_length
for {set k 0} {$k < $list_length} {incr k} { 
        set letter [lindex $letter_list $k]
	if {$letter == " "} { continue } else {
        after [expr 25 * $k * $k] ".c create text 150 40 -text \
			$letter -tags m$k"
               for {set i 0} {$i < 14} {incr i} {
		after [expr 25 * $k *$i] ".c move m$k -10 0"
			}
 	}}
}

# --------------------------------------------------------------
# Create the canvas
# --------------------------------------------------------------

canvas .c -bg white -width 200 -height 75
pack .c

# --------------------------------------------------------------
# Create the word list
# --------------------------------------------------------------


set words "Hello World"
set letter_list [split $words {}]

set list_length [llength $letter_list]

# --------------------------------------------------------------
# Start it up
# --------------------------------------------------------------

slide