Posted to tcl by thomas at Tue Mar 02 21:26:05 GMT 2010view raw
- proc getInsertionLineNb { } {
- return [expr [lindex [scan [.t index end] %d.%d] 0] -1]
- }
- text .t
- pack .t -expand yes -fill both
- .t tag configure lp -foreground blue
- .t insert end "\[timestamp1] "
- .t tag add lp [getInsertionLineNb].0 [getInsertionLineNb].end
- .t insert end "text1 to log\n"
- .t insert end "\[timestamp2] "
- .t tag add lp [getInsertionLineNb].0 [getInsertionLineNb].end
- .t insert end "text2 to log\n"