Version 4 of Slow text

Updated 2003-03-28 17:39:26

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."

Category Example | Category Animation | Arts and crafts of Tcl-Tk programming