in reply to Streaming into tk text widgets

You want to use Tk::fileevent. It is like IO::Select for Tk. This is untested, but should show you the idea. I'm not sure how your tie *STDOUT will work here. What fileevent does, is test for data in a filehandle, and if "readable", will read it and insert it into your Text widget. It is non-blocking, so your GUI will continue to run.
sub conn{ tie *STDOUT, 'Tk::Text',$t; $|++; $sock = new IO::Socket::INET(PeerAddr => 'myhost', PeerPort => '800', Proto => 'tcp'); die unless $sock; # while (defined($buff = <$sock>)){ # print $buff; # } $mw->fileevent($sock, 'readable', [\&fill_text_widget,$t]); } sub fill_text_widget { my($widget) = @_; $_ = <$sock>; $widget->insert('end', $_); $widget->yview('end'); }

I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re^2: Streaming into tk text widgets
by Scarborough (Hermit) on Oct 18, 2004 at 15:14 UTC
    Thanks to both of you for this help its given me the final piece to complete my little application.