how to get left click input in pygame

Solutions on MaxInterview for how to get left click input in pygame by the best coders in the world

showing results for - "how to get left click input in pygame"
Jan
26 Oct 2020
1run = True
2while run:
3    for event in pygame.event.get():
4        if event.type == pygame.QUIT:
5            run = False
6
7        if event.type == pygame.MOUSEBUTTONDOWN:
8            if event.button == 1:
9                print("left mouse button")
10            elif event.button == 2:
11                print("middle mouse button")
12            elif event.button == 3:
13                print("right mouse button")
14            elif event.button == 4:
15                print("mouse wheel up")
16            elif event.button == 5:
17                print("mouse wheel down")
18
similar questions
queries leading to this page
how to get left click input in pygame