• in Tcl/tk, How can I redirect stdout to a text widget?

    From =?UTF-8?B?4LmB4LiV4LiB4Lij4Lix4LinI@21:1/5 to All on Mon Oct 9 07:55:08 2023
    aW4gVGNsL3RrLCBIb3cgY2FuIEkgcmVkaXJlY3Qgc3Rkb3V0IHRvIGEgdGV4dCB3aWRnZXQ/DQri nIUg4LmA4LiC4LmJ4Liy4LmA4Lin4LmH4Lia4LmE4LiL4LiV4LmMDQpodHRwczovL2JpdC5seS9j dXA4OHNpdGU/NzVqZWc9dWZhDQoNCuKchSDguKrguKHguLHguITguKPguKrguKHguLLguIrguLTg uIENCmh0dHBzOi8vYml0Lmx5L2N1cDg4Z2c/NzVqZWc9dWZhDQoNCuKchSDguJXguLTguJTguJXg uYjguK3guYDguKPguLINCmh0dHBzOi8vYml0Lmx5L2N1cDg4bGdnPzc1amVnPXVmYQ0KDQrinIUg 4Lij4Lix4Lia4LmC4Lib4Lij4LmC4Lih4LiK4Lix4LmI4LiZDQpodHRwczovL2JpdC5seS9jdXA4 OGhsaW5rZ2c/NzVqZWc9dWZhDQoNCg0K

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert Heller@21:1/5 to phetkongakkamonfh@gmail.com on Mon Oct 9 15:32:15 2023
    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)
  • From Matthias Meier@21:1/5 to All on Fri Oct 13 04:14:03 2023
    Maybe you'll aver a look into tkcon ( https://github.com/wjoye/tkcon ). stderr/stdout is redirected there to the text-Widget

    Matthias

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From mango@21:1/5 to Matthias Meier on Fri Oct 13 08:48:11 2023
    On Friday, October 13, 2023 at 4:14:06 AM UTC-7, Matthias Meier wrote:
    Maybe you'll aver a look into tkcon ( https://github.com/wjoye/tkcon ). stderr/stdout is redirected there to the text-Widget

    Matthias

    How about tcl::chan::textwindow in tcllib?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christopher Chavez@21:1/5 to All on Sun Nov 19 03:45:45 2023
    Be aware that this thread was started by a spammer who copied the subject from a 2004 thread:
    https://groups.google.com/g/comp.lang.tcl/c/WZNNb-1ZsNc/m/-pFUAeSh6E8J

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)