use Tk;
$bottomFrame = MainWindow->new();
my $txt_summary = $bottomFrame->Scrolled( "Text",
-background => 'blue',
-foreground => 'white',
-height => '1',
-takefocus => '0',
-width => '40',
-scrollbars => 'oe',
)->pack(qw(-fill both -ex
+pand 1));
open(FH, "cuentos.txt") || die "no Abrio nada";
sub display_text {
if(eof(FH)) {
$bottomFrame->afterCancel($bottomFrame->{RepeatID});
close (FH);
$txt_summary -> Insert("\n== FIN ==",'end');
return;
} else {
chomp(my $line = <FH>);
$txt_summary -> Insert("\n$line",'end');
}
$txt_summary->see('end');
}
$bottomFrame->{RepeatID} = $bottomFrame->repeat(500, \&display_text);
MainLoop;
__END__
But probably you want Tk::fileevent. Note also that "Scrolled" means "attach a scrollbar to it", and not "scroll this widget".
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|