[Richard Suchenwirth] 2003-03-28 - Here is a little animation example: a message that is slowly, character after character, displayed on a [text] widget, giving the impression that it was being typed in real time. The word wrap is interesting to watch (that would not happen on a typewriter ;-) ---- proc slowtext {w text} { if {$text != ""} { $w insert end [string index $text 0] $w see end after 100 [list slowtext $w [string range $text 1 end]] } } # little demo pack [text .t -font {Courier 16 bold} -width 20 -height 4 -wrap word] slowtext .t "Tcl is one of the best scripting languages. Tk is one of the best toolkits for building graphical user interfaces. Both of them allow you to achieve much with little effort." [FW]: Or this one, which simulates human typing by having a random-distribution-within-a-fixed-range duration between each character. proc slowtext {w text} { if {$text != ""} { $w insert end [string index $text 0] $w see end after [expr {50 + int(rand()*50)}] [list slowtext $w [string range $text 1 end]] } } ---- ''[escargo] 31 Mar 2003'' - This page had been well structured for being reaped by [wiki-reaper] and [wish-reaper]; with the second definition of '''slowtext''' I don't know if that's still the case. It would be helpful for code authors to consider that adding code might make pages unreapable. ---- [Category Example] | [Category Animation] | [Arts and crafts of Tcl-Tk programming]