1while ... # your main loop
2 # get all events
3 ev = pygame.event.get()
4
5 # proceed events
6 for event in ev:
7
8 # handle MOUSEBUTTONUP
9 if event.type == pygame.MOUSEBUTTONUP:
10 pos = pygame.mouse.get_pos()
11
12 # get a list of all sprites that are under the mouse cursor
13 clicked_sprites = [s for s in sprites if s.rect.collidepoint(pos)]
14 # do something with the clicked sprites...
1while running: # Gameloop
2 for event in pygame.event.get(): # Checks all events
3 if event.type == pygame.MOUSEBUTTONDOWN: # If the current event is the mouse button down event
4 pos = pygame.mouse.get_pos() # Stores the mouse position