A Selection Of Ticker Tapes

[Sun Home | Tcl Plugin | Demos]

It's easy to do ticker tapes with the Tcl/Tk plugin:

Here's a ticker tape twice as fast as the above. In this one, I am also playing with event bindings on text. Notice how the cursor changes when you enter different messages, and how the foreground color changes:

And twice as fast again:


Here's the source for the first ticker tape, above:

set index 0 array set text_messages { 0 "What a nice day! Get away from the computer!" 1 "Sunny and cool at the ocean, breezy and cloudy" 2 "A day for the beach, not work, eh?" 3 "I tell yah, we're wasting away here. Time to go!" } proc doticker {t d f e} { global index text_messages scan [$t index 1.end] %d.%d line len if {[expr $len < $e]} { if {![info exists text_messages($index)]} { set index 0 } set message $text_messages($index) $t configure -state normal $t insert end "$f" fill $t insert end $message tag$index $t configure -state disabled incr index } $t configure -state normal $t delete 1.0 $t configure -state disabled after $d [list doticker $t $d $f $e] } text .t -relief ridge -bd 2 -wrap none -bg white -state disabled .t tag configure fill -foreground red .t tag configure tag0 -font *-times-bold-r-*-18-* -foreground blue1 .t tag configure tag1 -font *-times-medium-i-*-18-* -foreground blue4 .t tag configure tag2 -font *-times-medium-r-*-18-* \ -foreground RoyalBlue4 .t tag configure tag3 -underline true \ -foreground SlateBlue3 -font *-times-medium-i-*-18-* pack .t doticker .t 400 " ******* " 95