🧪 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_keys_pressed

Get a list of keys currently pressed. This is part of the reference section.

Purpose

Get a list of keys as Buttons.

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