SelectString
Introduction
SelectString
widget in Supervisely is a dropdown menu that allows users to select a single string value from a list of predefined options. It is commonly used when a specific string value is required as input, such as when selecting a specific class name or annotation type. Selected value can be accessed programmatically in the code.
Function signature
Parameters
Parameters | Type | Description |
---|---|---|
|
| Determine list of strings for |
|
| Determine list of label strings |
|
| Whether |
|
| Input placeholder |
|
| Size of input |
|
| Whether multiple-select is activated |
|
| Determine text on the right side of each item |
|
| Display help text with links for each item |
|
| ID of the widget |
values
Determine list of strings for SelectString
widget.
type: List[str]
labels
Determine list of label strings.
type: List[str]
or None
default value: None
filterable
Whether SelectString
is filterable.
type: Optional[bool]
default value: false
placeholder
Input placeholder.
type: Optional[str]
default value: select
size
Size of input.
type: Optional[Literal["large", "small", "mini", None]]
default value: None
multiple
Whether multiple-select is activated.
type: Optional[bool]
default value: false
items_right_text
Determine text on the right side of each item.
type: List[str]
or None
default value: None
items_links
Display help text with links for each item.
type: List[str]
or None
default value: None
widget_id
ID of the widget.
type: Optional[str]
default value: None
Methods and attributes
Attributes and Methods | Description |
---|---|
| Return selected item value. |
| Define string options to widget. |
| Return list of items from widget. |
| Decorator function is handled when input value is changed. |
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/blob/master/selection/009_select_string/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Get Dataset ID from environment variables
Get images infos from current dataset
Create Image
widget we will use in UI in this tutorial for demo
Image
widget we will use in UI in this tutorial for demoInitialize SelectString
widget
SelectString
widgetCreate app layout
Prepare a layout for app using Card
widget with the content
parameter and place widget that we've just created in the Container
widget.
Create app using layout
Create an app object with layout parameter.
Add functions to control widget from code
Last updated