is_mouse_pressed variable stores whether or not a mouse button is currently being pressed.
1 2 3 4 5 6 7 8 9 10 11 12
# click within the image and press # the left and right mouse buttons to # change the value of the rectangle def draw(): if py5.is_mouse_pressed and py5.mouse_button == py5.LEFT: py5.fill(0) elif py5.is_mouse_pressed and py5.mouse_button == py5.RIGHT: py5.fill(255) else: py5.fill(126) py5.rect(25, 25, 50, 50)
is_mouse_pressed variable stores whether or not a mouse button is currently being pressed. The value is
True when any mouse button is pressed, and
False if no button is pressed. The mouse_button variable (see the related reference entry) can be used to determine which button has been pressed.
Updated on September 11, 2021 16:51:34pm UTC