From Ken Corey (kcorey@eng.sun.com)
#!/usr/local/bin/wish
text .t -yscrollc {.sb set}
scrollbar .sb -command {.t yview}
button .b -text "Quit" -command {destroy .}
pack .sb -side right -fill y
pack .b -side bottom
pack .t -side left -fill both -expand 1
# Open the process we want to monitor hooked up to a pipe
# swap the #'s to enable 'foo | stdoutin.tcl':
set f [open "|stdoutin.pl" r]
#set f "stdin"
fileevent $f readable {
.t insert end "[gets $f]\n"
.t yview end
update idletasks
}
rename puts __puts
proc puts {args} {
if [llength $args]==1 {
putsToWindow $args
} else {
eval __puts $args
}
}
# needs handling of nonewline and
# definition of putsToWindow - creates Text widget if not already and
# adds putted text to end of it ...