[wxPython-users] A simple function but doesn't work!

Suzuki Alex Alex.Suzuki at ksta.ktzh.ch
Wed Nov 22 02:45:07 PST 2006


> I use a simple function to delete item from a canvas:
> 
> for object in listObjects:
>     canvas.RemoveObject(object)
>     listObject.remove(object)

You are modifying the sequence over which you are iterating. Something
bad is bound to happen. If you have to, iterate over a copy of the list.

--> http://docs.python.org/tut/node6.html

cheers,
  Alex




More information about the wxpython-users mailing list