I try to find in a matrix of rect
objects, the rect
that collide with mouse position but doesn't work.
def search_immagine(tab,event_pos):
for i in range(tab[0]):
for j in range(tab[0]): #matrix square
surface=tab[i][j]
surface=surface.get_rect()
if surface.collidepoint(event_pos):
return True
while not finished:
for event in pygame.event.get():
if event.type==pygame.QUIT:
cfinished=True
if event.type==pygame.MOUSEBUTTONDOWN:
search_image(image,event.pos)