in reply to Re: text widget in Perl/Tk question
in thread text widget in Perl/Tk question

Yes the code above is what I am using at the moment but the problem is when I open the same file in TextPad for instance, TextPad opens it in no time whereas when I use the code above in Perl/Tk, it takes ages to open it. Is this the limitation of the text widget and can I do something about it? Thanks
  • Comment on Re: Re: text widget in Perl/Tk question

Replies are listed 'Best First'.
Re: Re: Re: text widget in Perl/Tk question
by jdporter (Paladin) on Oct 30, 2002 at 18:36 UTC
    Well, certainly each call to $text->insert takes time. You can do it with just one call, like this:
    { local $/; $text->insert('end', <FILE> ); }
    That will insert the entire file at once.

    However, if the file is really large, you will always have problems trying to hold the entire file in memory at once. Good text editors are smart enough to page out the parts of the file not being viewed, in an efficient manner. You may have to resort to this kind of trick.