sashac88 has asked for the wisdom of the Perl Monks concerning the following question:
This works great. The only problem is that when I close the#!/usr/bin/perl use strict; use Tk; use IO::Handle; my $H=IO::Handle->new; open($H,"tail -f -n 50 z.txt |") or die $!; my $main = MainWindow->new; my $t=$main->Text(-wrap=>'none')->pack(-expand=>1); $main->fileevent(\*$H,'readable',[\&fill,$t]); MainLoop; sub fill { my ($w)=@_; my $text; my $text =<$H>; $w->insert('end',$text); $w->yview('end'); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Adding the output of tailf -f filename to Tk widget (scrolled)
by kyle (Abbot) on Feb 26, 2007 at 19:04 UTC |