0

Pygame mouse events

how do you check for pygame's mouse events like dragging the mouse ?

9th Jun 2017, 7:47 PM
khabz01
khabz01 - avatar
1 Answer
+ 1
Check MOUSEBUTTONDOWN, MOUSEBUTTONUP, and MOUSEMOTION events in pygame. You would do something like this: # global flag dragging = False . . . if event.type == pygame.MOUSEBUTTONDOWN: dragging = True elif event.type == pygame.MOUSEBUTTONUP: dragging = False elif event.type == pygame.MOUSEMOTION: if dragging: # do something
29th Jul 2017, 12:50 PM
Domagoj Puljić
Domagoj Puljić - avatar