Py5MouseEvent.get_action()
Contents
Py5MouseEvent.get_action()¶
Return the mouse event’s action.
Examples¶
1def setup():
2 py5.size(200, 200, py5.P2D)
3 py5.rect_mode(py5.CENTER)
4
5
6def draw():
7 py5.square(py5.random(py5.width), py5.random(py5.height), 10)
8
9
10def mouse_pressed(e):
11 py5.println('mouse pressed:', e.get_action() == e.PRESS)
12
13
14def mouse_released(e):
15 py5.println('mouse released:', e.get_action() == e.RELEASE)
16
17
18def mouse_clicked(e):
19 py5.println('mouse clicked:', e.get_action() == e.CLICK)
20
21
22def mouse_dragged(e):
23 py5.println('mouse dragged:', e.get_action() == e.DRAG)
24
25
26def mouse_moved(e):
27 py5.println('mouse moved:', e.get_action() == e.MOVE)
28
29
30def mouse_entered(e):
31 py5.println('mouse entered:', e.get_action() == e.ENTER)
32
33
34def mouse_exited(e):
35 py5.println('mouse exited:', e.get_action() == e.EXIT)
36
37
38def mouse_wheel(e):
39 py5.println('mouse wheel:', e.get_action() == e.WHEEL)
Description¶
Return the mouse event’s action. This value will always be implied by the triggered event function, but perhaps it might be useful to someone someday.
Underlying Processing method: getAction