Hosted by |
|
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:
Source: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 ticker {t d f e} { global index text_messages scan [$t index 1.end] %d.%d line len if {$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 ; # delete first char $t configure -state disabled after $d [info level 0] ; # repeat this command after delay } font create normFont -family Times -size 12 font create boldFont -family Times -size 12 -weight bold set t [text .t -wrap none -state disabled -font normFont \ -bd 1 -bg white -highlightthickness 0] $t tag configure fill -foreground red $t tag configure tag0 -font boldFont -foreground blue1 $t tag configure tag1 -foreground blue4 $t tag configure tag2 -foreground RoyalBlue4 $t tag configure tag3 -underline true -foreground SlateBlue3 pack $t set tick 400 if {[info exists embed_args(tick)]} { set tick $embed_args(tick) } ticker $t $tick " ******* " 95 |