How to distinguish right-click from left-click in Pygame?

Asked 1 years ago, Updated 1 years ago, 57 views

It's exactly what the title is.

Is there a way to distinguish left-click or right-click in Pygame?

if event.type == MOUSEBUTTONDOWN:

If you use MOUSEBUTTONDOWN or MOUSEBUTTONUP like this, Turning the mouse wheel is also recognized by clicking, making it possible to make a wide circle. How do you distinguish left-click from right-click?

python pygame

2022-09-21 10:24

1 Answers

I searched for you instead:

According to the link above...

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

Separate by the value of event.button:


2022-09-21 10:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.