You need to open up your external programs with IPC::Open3 ( possibly a 2>&1 redirect in a piped open), but IPC::Open3 is you general purpose solution. Here is a basic example, you setup a fileevent on the inputs:
#!/usr/bin/perl use warnings; use strict; use IPC::Open3; use Tk; my $mw = new MainWindow; $mw->geometry("600x400"); $mw->Button(-text => "See STDERR", -command => \&do_Toplevel)->pack(); my $tout = $mw->Scrolled( 'Text', -foreground => 'white', -background => 'black', -width => 80, -height => 20, )->pack; my $top = $mw->Toplevel(); $top->withdraw; my $terr = $top->Scrolled( 'Text', -foreground => 'hotpink', -background => 'black', -width => 80, -height => 20, )->pack; my $pid = open3( 0, \*OUT, \*ERR, "$0-sender" ); #the 0 is for ignoring \*IN (STDIN) $mw->fileevent( \*OUT, 'readable', \&write_out ); $mw->fileevent( \*ERR, 'readable', \&write_err ); MainLoop; ##################################################### sub do_Toplevel { if (! Exists($top)) { $top = $mw->Toplevel( ); $top->title("T-ERR"); $top->Button(-text => "Close", -command => sub { $top->withdraw })->pack; } else { $top->deiconify( ); $top->raise( ); } } ############################### sub write_out { my $str = <OUT>; $tout->insert( "1.0", $str ); $tout->see("1.0"); } ############################ sub write_err { my $str = <ERR>; $terr->insert( "1.0", $str ); $terr->see("1.0"); } ########################################### __END__
and the simple sender to play with
#!/usr/bin/perl use warnings; use strict; $| = 1; my $count = 0; while(1){ $count++; print "$count\n"; warn "\tuh oh warning $count\n"; sleep 1; }

I'm not really a human, but I play one on earth Remember How Lucky You Are

In reply to Re^9: Tk gui bug by zentara
in thread Tk gui bug by honyok

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.