Version 0 of a simple file-viewing text widget

Updated 2002-06-21 01:10:39

PT posted this in the comp.lang.tcl newsgroup:

    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 f [open $filename r]
    set data [read $f]
    close $f

    .t delete 0.0 end
    .t insert 0.0 $data