Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: How the Perl/TK scroll box like MSDOS rolling display data?

by zentara (Archbishop)
on Nov 28, 2012 at 10:50 UTC ( [id://1006005]=note: print w/replies, xml ) Need Help??


in reply to How the Perl/TK scroll box like MSDOS rolling display data?

Try this alternative:

#!/usr/bin/perl -w use Tk; use strict; my $host = 'localhost'; my $mw = MainWindow->new; my $t = $mw->Scrolled("Text",-width => 80, -height => 25, -wrap => 'none')->pack(-expand => 1); my $button = $mw->Button(-text => 'Execute', -command => \&ping_test)->pack; MainLoop(); sub ping_test { #print "Open Filehandle\n" or die "can't fork: $!"; open (PINGTEST, "ping $host 2>&1 |") or die "can't fork: $!"; $mw->fileevent(\*PINGTEST, 'readable', [\&fill_text_widget,$t]); $button->configure(-text => 'Stop', -command => sub{ print "Close Filehandle\n"; close PINGTEST;# or die "bad ping: $! S?"; print "All done!\n"; }); } sub fill_text_widget { my($widget) = @_; $_ = <PINGTEST>; $widget->insert('end', $_); $widget->yview('end'); }

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1006005]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 01:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found