Answers for "how to get left click input in pygame"

0

how to get left click input in pygame

run = True
while run:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False

        if event.type == pygame.MOUSEBUTTONDOWN:
            if event.button == 1:
                print("left mouse button")
            elif event.button == 2:
                print("middle mouse button")
            elif event.button == 3:
                print("right mouse button")
            elif event.button == 4:
                print("mouse wheel up")
            elif event.button == 5:
                print("mouse wheel down")
Posted by: Guest on February-22-2021

Code answers related to "how to get left click input in pygame"

Python Answers by Framework

Browse Popular Code Answers by Language