TagsListSelector
Introduction
Tags List Selector widget allows users to view a list of tag metas and change it dynamically using widget methods. This widget can be used for visualizing and selecting tags in Supervisely.
Function signature
tags_list_selector = TagsListSelector(
tag_metas=tag_metas,
multiple=False,
empty_notification=None,
widget_id=None
)Parameters
tag_metas
Union[List[TagMeta], TagMetaCollection]
Supervisely tag metas collection or list of tag metas
multiple
bool
Enable multiple tags selection
empty_notification
NotificationBox
Notification that will be displayed when there are no tags in widget
widget_id
str
ID of the widget
tag_metas
List of TagMeta objects or Supervisely object class collection (TagMetaCollection).
type: Union[List[TagMeta], TagMetaCollection]
multiple
If True then multiple tags can be selected. Otherwise, only one tag can be selected.
type: bool
default False
empty_notification
Notification that will be displayed when there are no tags in widget
type: NotificationBox
default None
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
set()
Set tags to widget.
get_selected_tags()
Return list of selected tags.
select_all()
Select all tags.
deselect_all()
Deselect all tags.
select()
Select tags by names.
deselect()
Deselect tags by names.
set_multiple()
Set multiple flag.
get_all_tags()
Return list of all tags.
@selection_changed
Callback triggers when selection is changed.
Mini App Example
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/selection/017_tags_list_selector/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Create list of tag metas
Initialize TagsListSelector widget, NotificationBox widget for custom notification and Text widget for displaying selected tags count
TagsListSelector widget, NotificationBox widget for custom notification and Text widget for displaying selected tags countCreate app layout
Prepare a layout for app using Card widget with the content parameter and place widget that we've just created into the Container widget.
Create app using layout
Create an app object with layout parameter.
Add functions to control widgets from python code
Last updated
Was this helpful?