libstp.ui.screens.input

Input screens for collecting user data.

Classes

NumberInputResult

Result from NumberInputScreen.

TextInputResult

Result from TextInputScreen.

SliderInputResult

Result from SliderInputScreen.

NumberInputScreen

Numeric input with touch keypad. Returns NumberInputResult.

TextInputScreen

Text input screen. Returns TextInputResult.

SliderInputScreen

Slider input screen. Returns SliderInputResult.

Module Contents

class libstp.ui.screens.input.NumberInputResult

Result from NumberInputScreen.

value: float
confirmed: bool
class libstp.ui.screens.input.TextInputResult

Result from TextInputScreen.

value: str
confirmed: bool
class libstp.ui.screens.input.SliderInputResult

Result from SliderInputScreen.

value: float
confirmed: bool
class libstp.ui.screens.input.NumberInputScreen(title: str = 'Input', prompt: str = 'Enter value:', unit: str = '', initial_value: float = 0, min_value: float | None = None, max_value: float | None = None, label: str = None, default: float = None)

Bases: libstp.ui.screen.UIScreen[NumberInputResult]

Numeric input with touch keypad. Returns NumberInputResult.

Example

result = await self.show(NumberInputScreen(

“Measurement”, “Enter measured distance:”, unit=”cm”, default=30.0

)) if result.confirmed:

distance = result.value

title = 'Input'
label = 'Enter value:'
unit = ''
value = None
min_value = None
max_value = None
build() libstp.ui.widgets.Widget

Build the screen layout.

Called on every render. Return a Widget tree describing what to display.

async on_key(key: str)
async on_adjust(value: float)
async on_submit()
async on_cancel()
class libstp.ui.screens.input.TextInputScreen(title: str = 'Input', prompt: str = 'Enter text:', default: str = '', placeholder: str = '', label: str = None)

Bases: libstp.ui.screen.UIScreen[TextInputResult]

Text input screen. Returns TextInputResult.

Example

result = await self.show(TextInputScreen(

“Name”, “Enter robot name:”, default=”MyRobot”

)) if result.confirmed:

name = result.value

title = 'Input'
label = 'Enter text:'
value = ''
placeholder = ''
build() libstp.ui.widgets.Widget

Build the screen layout.

Called on every render. Return a Widget tree describing what to display.

async on_change_value(value: str)
async on_submit()
async on_cancel()
class libstp.ui.screens.input.SliderInputScreen(title: str = 'Input', prompt: str = 'Select value:', min: float = 0, max: float = 100, default: float = None, label: str = None)

Bases: libstp.ui.screen.UIScreen[SliderInputResult]

Slider input screen. Returns SliderInputResult.

Example

result = await self.show(SliderInputScreen(

“Speed”, “Select speed:”, min=0, max=100, default=50

)) if result.confirmed:

speed = result.value

title = 'Input'
label = 'Select value:'
min = 0
max = 100
value = None
build() libstp.ui.widgets.Widget

Build the screen layout.

Called on every render. Return a Widget tree describing what to display.

async on_slider_change(value: float)
async on_change_value(value: float)
async on_submit()
async on_cancel()