OneOf
Last updated
Was this helpful?
Last updated
Was this helpful?
OneOf
is a container widget that can hold one of several child widgets, such as Radio
, Select
, or Switch
. Depending on the value selected by the user within these child widgets, the corresponding item will be added to the page markup. It is very convenient to quickly switch between different items without losing sight of the overall picture.
conditional_widget
ConditionalWidget
conditional widget with preset items (Select
, RadioButton
, Switch
)
widget_id
str
ID of the widget
Conditional widget with preset items.
type: ConditionalWidget
ID of the widget.
type: str
default value: None
You can find this example in our Github repository:
ui-widgets-demos/layoutsnand containers/008_one_of/src/main.py
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
You can use RadioGroup
, Select
or Switch
widgets to set in conditional_widget
parameter. In this tutorial we will use Select
widget.
Prepare sample images
Prepare items for Select
widget using Select.Item
Create Select
widget.
OneOf
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.