G'day markong,

"I'm open to suggestion on alternative GUIs"

That's lucky, because I don't know Gtk2. :-)

Here's a Tk solution which, I believe, does the sort of thing you want.

#!/usr/bin/env perl use strict; use warnings; use Tk; use Tk::ROText; my $mw = MainWindow::->new(); $mw->geometry('512x288+100+150'); my $ctrl_F = $mw->Frame( )->pack(-side => 'left', -fill => 'y'); my $text_F = $mw->Frame( )->pack(-side => 'left', -fill => 'both', -expand => 1); my $fill_x = $ctrl_F->Button(-text => 'Fill X')->pack(); my $fill_y = $ctrl_F->Button(-text => 'Fill Y')->pack(); my $text = $text_F->Scrolled('ROText', -scrollbars => 'osoe', -wrap => 'none', )->pack(-fill => 'both', -expand => 1); $fill_x->configure(-command => sub { $_->configure(-state => 'disabled') for $fill_x, $fill_y; my $ms = 50 * (1 + int rand 10); my $iters = 1 + int rand 100; my $iter = 0; my $id; $id = $mw->repeat($ms, sub { if (++$iter < $iters) { text_show($text, 'X'); } else { text_show($text, "\n"); $id->cancel; $_->configure(-state => 'normal') for $fill_x, $fill_y; } }); }); $fill_y->configure(-command => sub { $_->configure(-state => 'disabled') for $fill_x, $fill_y; my $ms = 50 * (1 + int rand 10); my $iters = 1 + int rand 100; my $iter = 0; my $id; $id = $mw->repeat($ms, sub { if (++$iter < $iters) { my $str = 'Y' x (1 + int rand 100) . "\n"; text_show($text, $str); } else { $id->cancel; $_->configure(-state => 'normal') for $fill_x, $fill_y; } }); }); MainLoop; { my ($line, $char); BEGIN { ($line, $char) = (1, 0) } sub text_show { my ($text, $str) = @_; $text->insert("$line.$char" => $str); $text->see("$line.$char"); if (-1 < index $str, "\n") { $line += $str =~ y/\n//; $char = length(substr $str, rindex $str, "\n") - 1; } else { $char += length $str; } } }

Notes:

— Ken


In reply to Re: GUI to dynamically show program output by kcott
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.