You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: py5_docs/Reference/api_en/Py5MouseEvent_get_count.txt
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,8 @@ get_count() -> int
10
10
@@ description
11
11
Get the number of mouse clicks. This will be 1 for a single mouse click and 2 for a double click. The value can be much higher if the user clicks fast enough.
12
12
13
+
This method also responds to the mouse wheel. It will be 1 when the mouse wheel is rotating down and -1 when the mouse wheel is rotating up.
14
+
13
15
@@ example
14
16
def setup():
15
17
py5.size(200, 200, py5.P2D)
@@ -22,3 +24,8 @@ def draw():
22
24
23
25
def mouse_clicked(e):
24
26
py5.println('mouse click count:', e.get_count())
27
+
28
+
29
+
def mouse_wheel(e):
30
+
direction = "down" if e.get_count() == 1 else "up"
0 commit comments