Button

class ev3dev2.button.Button

EV3 Buttons

Event handlers

These will be called when state of the corresponding button is changed:

on_up
on_down
on_left
on_right
on_enter
on_backspace

Member functions and properties

buttons_pressed

Returns list of names of pressed buttons.

any()

Checks if any button is pressed.

backspace

Check if backspace button is pressed.

check_buttons(buttons=[])

Check if currently pressed buttons exactly match the given list buttons.

down

Check if down button is pressed.

enter

Check if enter button is pressed.

evdev_device

Return our corresponding evdev device object

left

Check if left button is pressed.

static on_change(changed_buttons)

This handler is called by process() whenever state of any button has changed since last process() call. changed_buttons is a list of tuples of changed button names and their states.

process(new_state=None)

Check for currenly pressed buttons. If the new_state differs from the old state, call the appropriate button event handlers (on_up, on_down, etc).

right

Check if right button is pressed.

up

Check if up button is pressed.

wait_for_bump(buttons, timeout_ms=None)

Wait for buttons to be pressed down and then released. Both actions must happen within timeout_ms.

wait_for_pressed(buttons, timeout_ms=None)

Wait for buttons to be pressed down.

wait_for_released(buttons, timeout_ms=None)

Wait for buttons to be released.