Items drawn to the canvas are persistent. create_rectangle
returns an item id that you need to keep track of. If you don't remove old items your program will eventually slow down.
From Fredrik Lundh's An Introduction to Tkinter:
Note that items added to the canvas are kept until you remove them. If you want to change the drawing, you can either use methods like
coords
,itemconfig
, andmove
to modify the items, or usedelete
to remove them.