Re: Using a tk text widget for stdout



WillemF wrote:
I am using a text widget as a substitute for the stdout of binary
executables in Linux.
e.g: if t is the tk text widget:

$t insert end [exec ./dnaml < dnaml.setup]

However, the whole output of dnaml to stdout is only appended within
the widget after dnaml has completed execution. While dnaml is
executing, no output appears in the widget. I need to see the output as
it is produced, more or less as it would appear in a terminal window.
Id there any way around this problem? Is the text widget perhaps
inappropriate? I would greatly appreciate any advice.

In Linux no problem. Just do:

proc getResult {channel} {
.t insert end [read $channel]
}
set f [open | ./dnaml < dnaml.setup]
fconfigure $f -blocking 0
fileevent $f readable "getResult $f"

This code doesn't work in Windows though, you'll get the output only
after a program terminates just like what you're getting now.

.



Relevant Pages

  • Using a tk text widget for stdout
    ... I am using a text widget as a substitute for the stdout of binary ... executables in Linux. ... the whole output of dnaml to stdout is only appended within ...
    (comp.lang.tcl)
  • Re: Getting focus in Tk app started from C++
    ... just tried it on both WinXP and Linux). ... parent window has focus not the widget. ... The script works as expected ...
    (comp.lang.tcl)
  • Re: TAKE_FOCUS
    ... phil wrote: ... Works on Linux. ... I have a function I need to run when the window ... Direct input focus to this widget. ...
    (comp.lang.python)
  • Re: ANNOUNCE: Tile widget set, release 0.7.8
    ... sometimes seen in the lower right corner that resizes ... the window when dragged). ... (I suppose Linux issues are not important since this widget is probably only intended for Windows...) ...
    (comp.lang.tcl)
  • Remote USB switch
    ... I have a high speed USB v2 widget which is a distance from my PC. ... different O/S (i.e. Linux) which don't like to see my widget and can cause ... So I have to constantly plug/unplug my widget depending on what I'm ...
    (sci.electronics.design)

Loading