package require Tk text .t -yscrollcommand {.s set} scrollbar .s -command {.t yview} pack .s -side right -fill y pack .t -side left -fill both -expand 1 set filename "readme.txt" set f [open $filename r] set data [read $f] close $f .t delete 0.0 end .t insert 0.0 $data
And Marty Backe posted this as a follow-up:
package require Iwidgets iwidgets::scrolledtext .t pack .t -fill both -expand true .t insert $filename end # To clear the widget between file reads: .t clear
HJG 2016-02-07: The first example obviously needed a filename, and the second example doesn't work.I guess Iwidgets are broken/unmaintained (dated 2002 / tcl 8.3.3). See also scrolledtext.