Select
Last updated
Last updated
Select
widget in Supervisely is a graphical user interface element that allows users to choose an option from a predefined list. It presents the options as a dropdown menu that can be expanded and collapsed by clicking. Select
widget has event handler that is triggered when the user selects an option from the dropdown menu. This can be useful for applications that require users to take an action based on the selected option, such as filtering content or displaying specific information.
items
List[Select.Item]
List of Select.Item
widgets
groups
List[Select.Group]
List of Select.Group
widgets
filterable
bool
Whether Select
is filterable
placeholder
str
Placeholder
size
Literal["large", "small", "mini", None]
Size of input
multiple
bool
Whether multiple-select is activated
widget_id
str
ID of the widget
Determine list of Select.Item
widgets.
type: List[Select.Item]
default value: None
Prepare select items:
Initialize widget with given items:
Determine list of Select.Group
widgets.
type: List[Select.Group]
default value: None
Prepare select items and groups:
Initialize widget with given groups of items:
Whether Select
is filterable.
type: bool
default value: false
Placeholder. It needs to set multiple=True
parameter.
type: str
default value: select
Size of input.
type: Literal["large", "small", "mini", None]
default value: None
Whether multiple-select is activated.
type: bool
default value: false
ID of the widget.
type: str
default value: None
get_value()
Return selected item value.
get_items()
Return list of items from widget.
get_label()
Return selected item label.
get_labels()
Return list of labels for all items
set(items: List[Select.Item] = None, groups: List[Select.Group] = None)
Set Select
input items or group of items.
set_value(value: str)
Set Select
input value.
disable_item(item_index: int, group_index: int = None)
Disable item by index.
enable_item(item_index: int, group_index: int = None)
Enable item by index.
disable_group(group_index: int)
Disable group by index.
enable_group(group_index: int
Enable group by index.
@value_changed
Decorator functions is handled when input value is changed.
You can find this example in our Github repository:
ui-widgets-demos/selection/001_select/src/main.py
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Select
widget using Select.Item
and Select.Group
Select
widgetPrepare a layout for app using Card
widget with the content
parameter and place widget that we've just created in the Container
widget.
Create an app object with layout parameter.