http://qs321.pair.com?node_id=297895


in reply to Re: POE, was Re: Tk tail -f - How?
in thread Tk tail -f - How?

You might want to add a check for the number of lines you have in the listbox and limit it to some reasonable size.

If your file grows quickly, you could rapidly find yourself running out of memory, and (if my limited experience of Tk is still valid) things start to slow down when widgets grow beyond a certain size.

It would be more efficient to load the listbox using

$listbox->insert( 'end', <F> ); $listbox->see( 'end' ); $mw->update();

Also, you probably shouldn't be seeking to the end after you have read. If nothing has been added, it will make no difference as you will already be there. However, if something was added between the last read and the seek, you will never read it and lines (or partial lines) will be lost..


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail