Tkinter slowes down

Fredrik Lundh fredrik at pythonware.com
Sat May 28 09:28:59 EDT 2005


"pavel.kosina" <geon at post.cz> wrote:

> It seems to me that in my "again and again repainting canvas" script the
> rendering is slowing down as the time goes.

when you add an item to the canvas, it's part of the canvas
until you remove it.  if performance drops, it's usually because
you keep adding new items without removing the old ones.

try adding a w.delete(ALL) call before you "repaint".

for better performance, you should restructure your code so
it modifies existing canvas items, when possible, rather than
deleting and recreating items all the time.

if you want a light-weight canvas, you might wish to look at

    http://effbot.org/zone/wck.htm

and especially

    http://effbot.org/zone/wck-3.htm

</F>






More information about the Python-list mailing list