🧪 Version 0.3.1 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 Button (Keyboard)

Information about key in the keyboard. This is part of the reference section.

Purpose

Information about a keyboard key like a standardized name if available.

Snippet

Get a key currently pressed.
buttons = sketch.get_keyboard().get_keys_pressed()
if len(buttons) > 0:
print(buttons[0].get_name())

Examples

Availability

Available for Sketch2DApp and Sketch2DWeb. Note that, on web, some keys may be intercepted by the operating system like the ctrl key and may not be available to the sketch.

See also