[Python] Is there any way aside from the event handler to check for mouse button down?

Discussão em 'Python' iniciado por Stack, Maio 11, 2025.

  1. Stack

    Stack Membro Participativo

    mouse_pos = pg.mouse.get_pos() for space in movable: if space.collidepoint(mouse_pos): print(space) for event in pg.event.get(): if event.type == pg.MOUSEBUTTONDOWN: print("HELLO THERE")

    Im trying to check for mousebutton down in a specific rectangle, however I think that the reason it dosen't work is that the pygame.event.get() function is called for numerous times during the whole gameloop and checking for pg.MOUSEBUTTONDOWN.

    Are there any solutions to this?

    I did try to gather all the events in a list and then check but that didn't work.

    Continue reading...

Compartilhe esta Página