Button

class ev3dev2.button.Button

EVB 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

evdev_device_name = None

These handlers are called by process() whenever state of ‘up’, ‘down’, etc buttons have changed since last process() call

up

Check if ‘up’ button is pressed.

down

Check if ‘down’ button is pressed.

left

Check if ‘left’ button is pressed.

right

Check if ‘right’ button is pressed.

enter

Check if ‘enter’ button is pressed.

any()

Checks if any button is pressed.

backspace

Check if ‘backspace’ button is pressed.

buttons_pressed

Returns list of names of pressed buttons.

check_buttons(buttons=[])

Check if currently pressed buttons exactly match the given list.

evdev_device

Return our corresponding evdev device object

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.

wait_for_bump(buttons, timeout_ms=None)

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

wait_for_pressed(buttons, timeout_ms=None)

Wait for the button to be pressed down.

wait_for_released(buttons, timeout_ms=None)

Wait for the button to be released.