RadioGroup
Introduction
RadioGroup widget in Supervisely is a user interface element that allows users to create a group of mutually exclusive options that can be selected via radio buttons. With the RadioGroup widget, users can define a set of options, each with a corresponding radio button, and only one option (RadioGroup.Item) can be selected at a time. Overall, RadioGroup widget is a valuable tool for simplifying user interactions and improving the usability of Supervisely apps.
Function signature
RadioGroup(
items, size=None,
direction="horizontal",
gap=10,
widget_id=None,
)
Parameters
items
List[RadioGroup.Item]
List of RadioGroup content
size
Literal["large", "small", "mini", None]
RadioGroup size
direction
Literal["vertical", "horizontal"]
RadioGroup items direction
gap
int
Gap between RadioGroup items
widget_id
str
ID of the widget
items
Determine list of RadioGroup items.
type: List[RadioGroup.Item]
size
Determine RadioGroup size.
type: Literal["large", "small", "mini", None]
default value: None
direction
Determine RadioGroup items direction.
type: Literal["vertical", "horizontal"]
default value: horizontal

gap
Determine gap between RadioGroup items.
type: int
default value: 10

widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
get_value()
Return selected RadioGroup.Item value.
set(items: List[RadioGroup.Item])
Set given list of RadioGroup.Item in RadioGroup.
set_value(value: str)
Set given value by value of RadioGroup.Item.
@value_changed
Decorator function is handled when input RadioGroup is changed.
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/controls/003_radio_group/src/main.py
Import libraries
Initialize RadioGroup.Item to use in RadioGroup
RadioGroup.Item to use in RadioGroupInitialize RadioGroup widget
RadioGroup widgetInitialize OneOf widget to have ability to choose RadioGroup.Item content
OneOf widget to have ability to choose RadioGroup.Item contentCreate app layout
Prepare a layout for app using Card widget with the content parameter.
Create app using layout
Create an app object with layout parameter.

Last updated
Was this helpful?