RadioTable
Introduction
RadioTable
widget in Supervisely is a user interface element that allows creating a table of options, each with a corresponding radio button. With RadioTable
widget, developer can define multiple rows of options, and only one row option can be selected. The RadioTable widget provides a convenient and intuitive way to navigate and make selections within the table.
Function signature
Parameters
columns
List[str]
RadioTable
columns names
rows
List[List[str]]
RadioTable
rows content
subtitles
Union[Dict[str, str], List]
Determine subtitles for columns
column_formatters
Dict
Determine format of output RadioTable
widget_id
str
ID of the widget
columns
Determine RadioTable
columns names.
type: List[str]
rows
Determine RadioTable
rows content.
type: List[List[str]]
subtitles
Determine subtitles for columns.
type: Union[Dict[str, str], List]
default value: {}
column_formatters
Determine format of output RadioTable
.
type: Dict
default value: {}
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
columns
Get or set columns
property.
subtitles
Get or set subtitles
property.
rows
Get or set rows
property.
format_value(column_name: str, value: list)
Return column formatter function by given column name.
default_formatter(value: list)
Return default column formatter.
get_selected_row()
Return selected row data.
get_selected_row_index()
Return selected row index.
set_columns(columns: List[str], subtitles: Union[Dict[str, str], List[str]])
Set table columns by given list of column names.
set_data(columns: List[str], rows: List[List[str]], subtitles: Union[Dict[str, str], List[str]])
Set table data.
select_row(row_index: int)
Set row selected by given index. If row with given index does not exist raise ValueError
.
@value_changed
Decorator function is handled when widget value is changed
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/tables/003_radio_table/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Initialize RadioTable
widget
RadioTable
widgetCreate additional widgets we will use in UI
Create 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 widgets from code
Last updated