in reply to Perl:TK - standard output to text widget
You can tie STDOUT to a Tk::Text object to have anything printed in perl appear in the text widget. This doesn't handle input, of course, nor does it work with any external programs you might call (for those, see the previous suggestions).
#!/usr/bin/winperl use warnings; use strict; use Tk; my $mw = MainWindow->new(); my $tx = $mw->Text()->pack(); tie *STDOUT, 'Tk::Text', $tx; $mw->repeat(1000, \&tick); MainLoop; my $count; sub tick { ++$count; print "$count\n"; }
bbfu
Black flowers blossom
Fearless on my breath
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Perl:TK - standard output to text widget
by crabbdean (Pilgrim) on Feb 28, 2004 at 09:12 UTC | |
by bbfu (Curate) on Mar 13, 2004 at 00:26 UTC |
In Section
Seekers of Perl Wisdom