Posted to tcl by mjanssen at Tue Dec 06 13:29:52 GMT 2011view raw
- proc log {widget line} {
- set lines [.t count -lines 1.0 end]
- puts $lines
- if {$lines > 10} {
- # delete first line
- .t delete 1.0 2.0
- }
- # add next line
- .t insert end \n$line
- }
- text .t
- pack .t
- proc every {ms body} {eval $body; after $ms [info level 0]}
- every 500 {incr ::num ; log .t "line $::num"}