Answers for "python pygame mouse events"

3

mouse in pygame

pygame.mouse.get_pos() #-> get the mouse cursor position on the screen in taple
#-> (x, y)

if event.type == pygame.MOUSEBUTTONDOWN:
    print(event.button)

#------------------------#
1 - left click
2 - middle click
3 - right click
4 - scroll up
5 - scroll down
#------------------------#
Posted by: Guest on July-28-2021

Python Answers by Framework

Browse Popular Code Answers by Language