🧪 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_name (Mouse)

Information about a mouse button. This is part of the reference section.

Purpose

Get information about mouse button or an emulated button in the case of a touch screen. Uses the following names:
Mouse Touchscreen Value Constant
Left Button Single Finger Tap 'leftMouse' sketchingpy.const.MOUSE_LEFT_BUTTON
Right Button Two Finger Tap 'rightMouse' sketchingpy.const.MOUSE_RIGHT_BUTTON
Note that scrollwheel events are not currently supported due to complications with web.

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. Note that, on web, right click may be intercepted by the operating system and may not be available to the sketch or may be delayed.

See also