Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by zentara (Archbishop)
on Nov 28, 2012 at 10:50 UTC ( #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


Comment on Re: How the Perl/TK scroll box like MSDOS rolling display data?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2015-07-08 07:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (96 votes), past polls