kcott, thank you very much!

The example really does what I need but unfortunately it doesn't show correctly the progress bar of the command. This is probably due to the fact that the textual progress bar includes a counter which is implemented by printing "\r" char (below the entire C function).

void doProgress(char* label, size_t step, size_t total) { //progress width const int pwidth = 60; //minus label len size_t width = pwidth - strlen(label); size_t pos = (step * width) / total; size_t percent = (step * 100) / total; printf("\r%s%4d/%4d [", label, step, total); int i; //fill progress bar with = for (i = 0; i < pos; i++) { printf("%c", '='); } //fill progress bar with spaces printf("% *c", width - pos + 1, ']'); printf("%3d%%", percent); fflush(stdout); }

The net result is that I get a mess displayed when I add the text to the TextView, because TextView doesn't interpret char escape sequences. I get the same result using Tk::DoCommand.

After a little bit of searching I think that I could probably solve the thing by using pseudo-ttys in Tk or even embedding Xterm(1) inside Tk !

The two examples are all in python, so I'd just ask if the same can be done with Perl Tk (maybe playing with IPC::Run module pseudo-ttys support) ?

Comments and further suggestions are always welcome!


In reply to Re^2: GUI to dynamically show program output by markong
in thread GUI to dynamically show program output by markong

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.