Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions py5_docs/Reference/api_en/Py5MouseEvent_get_count.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ get_count() -> int
@@ description
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.

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.

@@ example
def setup():
py5.size(200, 200, py5.P2D)
Expand All @@ -22,3 +24,8 @@ def draw():

def mouse_clicked(e):
py5.println('mouse click count:', e.get_count())


def mouse_wheel(e):
direction = "down" if e.get_count() == 1 else "up"
py5.println(f"mouse wheel rotating {direction}")