🧪 Version 0.2.2 is our alpha release candidate. Please send us bug reports and suggestions!

Sketchingpy

Creative coding and interactive science everywhere for everyone: web, desktop, mobile, Jupyter, and more. Open source!

Reference for get_mouse

Get access to the mouse. This is part of the reference section.

Purpose

Get access to the mouse currently registered with the operating system for the sketch. Different sketches running at the same time may have different mouse objects depending on focus or OS configuration. Returns None if not supported on the platform or a mouse or equivalent is not connected. May also be emulated if the device uses a touch screen.

Snippet

Get a button currently pressed.
buttons = sketch.get_mouse().get_buttons_pressed()
if len(buttons) > 0:
print(buttons[0].get_name())

Examples

Availability

Available for Sketch2DApp and Sketch2DWeb.

See also