TagsListPreview
Introduction
Tags List Preview widget simply displays a list of tags. It can be used to display tags that were selected by the user in the Tags List Selector widget for example.
Function signature
tags_list_preview = TagsListPreview(
tag_metas=tag_metas,
max_width=300,
empty_text=None,
widget_id=None,
)Parameters
tag_metas
Union[List[ObjClass], ObjClassCollection]
Supervisely tag meta collection or list of tag metas
max_width
int
Max width of the widget
empty_text
str
Text 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 tag meta collection (TagMetaCollection).
type: Union[List[TagMeta], TagMetaCollection]
max_width
Set the maximum width of the widget in pixels.
type: int
default 300
empty_text
Text that will be displayed when there are no tags in widget
type: str
default None
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
set()
Set tag metas to widget.
Mini App Example
In this example we will create a mini app with TagsListPreview widget. We will create a TagsListSelector widget and display selected tags with TagsListPreview widget.
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/media/018_tags_list_preview/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 and init TagsListSelector widget
TagsListSelector widgetInitialize TagsListPreview widget and Text widget for displaying number of selected tags
TagsListPreview widget and Text widget for displaying number of selected tagsCreate app layout
Prepare a layout for app using Card widget with the content parameter and place widgets that we've previously 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?