Tkinter Text widget getting too slow

Michael Peuser mpeuser at web.de
Wed Sep 3 13:59:24 EDT 2003


"Jane Austine" <janeaustine50 at hotmail.com> schrieb im Newsbeitrag
news:ba1e306f.0309030713.ef2ec4a at posting.google.com...
> As you add more items, say text lines, in Text widget, it gets too
> slow and almost impractical to use on. Take idle for example. If the
> text gets bigger(e.g. print
> urllib.urlopen('http://www.amazon.com').read() ), it becomes too
> sluggish to use as an "interactive" shell.
>
> I have tried wxPython and it seems to have the same problem (from my
> experience using PyCrust).
>
> Is there any way to speed up Text widget, or should I look for another
> GUI library?

This seems to be a problem with most naivly written wigdets which store
their data in some internal format. What I have done several times is
writing my own widgets. This is possible for Tkinter by using Fredrik
Lundh's WCK (Widget Construction Kit)
http://effbot.org/zone/wck.htm
He has some tutorials and the whole thing is well integrated in Tkinter. He
especially has a tutorial on using HUGE datasets.

Of course you have to undergo some programming for all the features you
would want to use in your text widget. (Highliting, linebreaks,..etc)

I implemented a binary editor some time ago, which is extremely fast with
even a 100 MB file. (For I/O it used memory mapped files, but this is not
the reason it is fast; it just simplified the programmin :-))

Kindly
Michael P







More information about the Python-list mailing list