SelectDataset widget is a dropdown menu that allows users to select a dataset or multiple datasets from a list of available datasets in the current project. It displays the name of each dataset in the list.
Function signature
Copy SelectDataset (
default_id = None ,
project_id = None ,
multiselect = False ,
compact = False ,
show_label = True ,
size = None ,
disabled = False ,
widget_id = None ,
select_all_datasets = False ,
allowed_project_types = [],
) Parameters
Type
Description
Allow to select all datasets in current project
Literal["large", "small", "mini", None]
List of allowed project types
Determine Dataset will be selected by default.
type: int
default value: None
Determine Project will be selected by default.
type: int
default value: None
Allow to select multiple datasets in current project.
type: bool
default value: false
Show only Dataset select.
type: bool
default value: false
Determine show text Dataset on widget or not, work only if compact is True.
type: bool
default value: True
Size of input.
type: Literal["large", "small", "mini", None]
default value: None
Determine Dataset select ability.
type: bool
default value: false
select_all_datasets
Select all datasets in current project. Work only if multiselect is True.
type: bool
default value: false
allowed_project_types
List of allowed project types.
type: List[ProjectType]
default value: None
ID of the widget.
type: str
default value: None
Methods and attributes
Attributes and Methods
Description
Return selected dataset ID, if multiselect is True raise ValueError.
Return selected dataset IDs, if multiselect is False raise ValueError.
get_selected_project_id()
Return id of selected Project, if compact is False.
Set disabled attribute == True.
Set disabled attribute == False.
Decorator functions is handled when selected dataset ID is changed.
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/selection/005_select_dataset/src/main.pyarrow-up-right
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Prepare project_id and dataset_id
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.