[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] more list problems



so I have been able to write pygame.Rect rectangles into rect-type lists. but now I'm trying to delete unwanted rectangles that are printed to the screen.

when I draw one at a time, I can only delete the last drawn rectangle before deleting the previous ones. I want to be able to delete any rectangle at any time without problems. I've come close but have run into a wall.

below is the "deleting rect" section. if anyone needs more then what's provided i can provide it upon request.

thanks in advance.

[code]
if event.button == 3:
                                mousexTEMP, mouseyTEMP = pygame.mouse.get_pos()
                                for i in range(0, len(rect)):
                                    if rect[i].collidepoint(mousexTEMP, mouseyTEMP):
                                            del rect[i]   
                                                numRect -= 1
[/code]