On Sat, 28 May 2005 18:21:46 +0200, pavel.kosina <[EMAIL PROTECTED]> wrote:

> Fredrik Lundh napsal(a):
>> 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".

I noticed once that if this actually deletes all canvas items, it does not 
delete the bindings on them: every binding put on a canvas item registers a 
Python callable at tcl level, but does not associate it with the item. So 
deleting the item keeps the binding even if it cannot be called anymore. If you 
have many items with several bindings, this can cause the memory usage to grow 
up and slow down the canvas.

> In the meantime I found that widget.destroy() works well, too (before
> "repainting").

This was the only solution I found using "regular" Tkinter widgets when there 
are bindings on canvas items. I tried to find another solution by modifying 
Tkinter.py, but the problem is much harder than it seems, since many things 
happen at tcl level. However, I didn't investigate the WCK.

HTH
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in 
'U(17zX(%,5.zmz5(17;8(%,5.Z65\\'*9--56l7+-'])"
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to