in reply to Tk GUI and Listen?
Just run this as your "capture" script.
#!/usr/bin/perl use strict; use Tk; use IO::Handle; my $H=IO::Handle->new; open($H,"tail -f -n 1 test.dat |") or die $!; my $main = MainWindow->new; my $t = $main->Text( -wrap=>'none', -height => 2, )->pack(-expand=>1); $main->fileevent(\*$H,'readable',[\&fill,$t]); MainLoop; sub fill { my ($w) = @_; my $text; my $text =<$H>; $w->delete('0.0','end'); $w->insert('end',$text); $w->yview('end'); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Tk GUI and Listen?
by Anonymous Monk on Oct 27, 2006 at 14:29 UTC | |
by zentara (Cardinal) on Oct 27, 2006 at 14:48 UTC | |
by Anonymous Monk on Oct 27, 2006 at 15:05 UTC |