libstp.ui.screens.input¶
Input screens for collecting user data.
Classes¶
Result from NumberInputScreen. |
|
Result from TextInputScreen. |
|
Result from SliderInputScreen. |
|
Numeric input with touch keypad. Returns NumberInputResult. |
|
Text input screen. Returns TextInputResult. |
|
Slider input screen. Returns SliderInputResult. |
Module Contents¶
- class libstp.ui.screens.input.NumberInputResult¶
Result from NumberInputScreen.
- class libstp.ui.screens.input.TextInputResult¶
Result from TextInputScreen.
- class libstp.ui.screens.input.SliderInputResult¶
Result from SliderInputScreen.
- 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_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_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_submit()¶
- async on_cancel()¶