F
Fredrik Lundh
Stewart said:I've got a Tkinter app that draws three histograms. At this point I am
simulating real data by drawing rectangles whose size is defined by random
numbers; in the future there would be real data coming from a server.
I want to redraw the rectangles every time I press the Again button. This works
for me, but I get an extra set of rectangles each time I press the Again button.
How to get rid of this effect?
the create methods add new objects to the canvas. if you want
to replace them, you can either get rid of the old objects (using
delete(id) or even delete(ALL)) or you can modify the objects in
place (itemconfig, coords).
more info here:
http://www.pythonware.com/library/tkinter/introduction/canvas.htm
(see "item specifiers" under "concepts", and the "methods" section)
if you need to rapidly redraw things in a Tkinter widget, the WCK is
often a lot more efficient:
http://www.effbot.org/zone/wck.htm
</F>