
How to read a file onto the text widget
|> The title says what I want.
|>
|> Any hint?
|> Thanx.
text .t -height 5 -width 80; # plus any other parameters like -wrap & -yscroll
set F [open $filename "r"]
gets $F Line
while {! [eof $F]} {
.t insert end $Line
gets $F Line
Quote:
}
close $F
Simple, eh? Now, if you want scrollbars...
text .t -yscroll ".ysb set" -xscroll ".xsb set" ...
scrollbar .ysb -relief sunken -command ".t yview"
scrollbar .xsb -relief sunken -command ".t xview" -orient horiz
pack append . \
.ysb {right filly} \
.xsb {bottom fillx} \
.t fill
Hope that helps...
--
Norm.
+-----------------------------------------------------------------------+
Norm MacNeil Phone: (613) 763-3372
Data Systems Fax: (613) 765-2854
#include <disclaimer.std> "Roller bladers do it in-line!"