About py5
Getting Started
Tutorials
How To...
Discussion
Reference
Developer Information
Identify the mouse button used in the event.
def setup(): py5.size(200, 200, py5.P2D) py5.rect_mode(py5.CENTER) def draw(): py5.square(py5.random(py5.width), py5.random(py5.height), 10) def mouse_clicked(e): mouse_button = e.get_button() if mouse_button == py5.LEFT: py5.println('left mouse click') elif mouse_button == py5.CENTER: py5.println('center mouse click') elif mouse_button == py5.RIGHT: py5.println('right mouse click')
Identify the mouse button used in the event. This can be LEFT, CENTER, or RIGHT.
LEFT
CENTER
RIGHT
Underlying Processing method: getButton
get_button() -> int
Updated on September 01, 2022 16:36:02pm UTC