At Mon, 9 Oct 2023 07:55:08 -0700 (PDT) ?????? ???????????????? <
phetkongakkamonfh@gmail.com> wrote:
in Tcl/tk, How can I redirect stdout to a text widget?
Is this from a sub-process (eg launched with exec)? If so, use open with a pipe:
replace
exec some command line
with
pack [text .t] -expand yes -fill both
set fp [open "|some command line" r]
fileevent readable $fp "writeToText $fp .t"
proc writeToText {chan text} {
if {[gets $chan line] < 0} {
catch {close $chan}
} else {
$text insert end "$line\n"
}
}
--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@deepsoft.com -- Webhosting Services
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)