in reply to insert in Text widget
while (<$fh>) { $st->insert("end", $_); }
You probably want
use strict; use warnings; use Tk; my $fh; open ($fh, "<D:\\perl_script\\sqlnet.log") or die "error!!$!\n"; my $mw = MainWindow->new(); my $st = $mw->Scrolled("Text",-scrollbars => "eo")->pack(); my $id = $st->repeat(3000,\&list); MainLoop; close ($fh); sub list { if (eof($fh)) { $st->aftercancel($id); return; } my $line = <$fh>; $st->insert('end', $line); $st->see('end'); }
Roughly.
--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}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: insert in Text widget
by xiaoyafeng (Deacon) on May 25, 2007 at 08:22 UTC |