Version 1 of Slow text

Updated 2003-03-28 17:18:58

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]
         after 100 [list slowtext $w [string range $text 1 end]]
     }
 } 
 #----------------- little demo
 pack [text .t -font {Courier 16 bold} -width 30 -height 10 -wrap word]
 slowtext .t "Tcl is one of the best scripting languages. 
 Tk is one of the best toolkits for building graphical user interfaces."

Category Example | Arts and crafts of Tcl-Tk programming