UI Control¶
LedColor¶
- class brian.uicontrol.LedColor(red: int, green: int, blue: int)
- __init__(red: int, green: int, blue: int)
Holds color definition for UI LEDs. Color values range from 0 to 255. When outside of this range, the values are clamped
- red: int
Red component of the color, in range from 0 to 255. When set to a value outside of this range, the value is clamped
- green: int
Green component of the color, in range from 0 to 255. When set to a value outside of this range, the value is clamped
- blue: int
Blue component of the color, in range from 0 to 255. When set to a value outside of this range, the value is clamped
enable knob rotation animation¶
- brian.uicontrol.enable_knob_rotation_animation(enabled: bool) None
If enabled, OS automatically animates the LEDs under the knob when it rotates. The user program starts in the enabled state.
- Parameters:
enabled – Whether to animate knob rotation.
UI Event Listener¶
KnobEvent¶
- class brian.uicontrol.UiEventsListener.UiEventsListener.KnobEvent
- turn_delta: int
- turned_to: int
- is_pressed: bool
- just_pressed: bool
- just_released: bool
Knob¶
- class brian.uicontrol.UiEventsListener.UiEventsListener.Knob
- wait_for_any_turn(timeout_ms: int = -1) bool
Waits for next any turn of the knob. This function is blocking.
- Parameters:
timeout_ms – Maximum number of milliseconds to wait. - If the timeout is negative, the function will wait indefinitely.
- Return success:
True: If the desired button event was caught.False: If the timeout ran out.
- wait_for_directional_turn(clockwise: bool, timeout_ms: int = -1) bool
Waits for next directional turn of the knob. This function is blocking.
- Parameters:
clockwise – Whether to wait for clockwise or counterclockwise turn.
timeout_ms – Maximum number of milliseconds to wait. - If the timeout is negative, the function will wait indefinitely.
- Return success:
True: If the desired button event was caught.False: If the timeout ran out.
- last_button_event: KnobEvent