InputTag
Last updated
Last updated
InputTag
widget in Supervisely is a user interface element that allows users to add or remove tag labels to items (images, videos, volumes, and point clouds). It uses TagMeta
of the current project and allow to use them easily in Supervisely apps. InputTag
widget is a valuable tool for improving the organization and efficiency of Supervisely apps.
Determine TagMeta
from which Tags
will be selected. Possible Tag
types: any_number
, any_string
, one_of_string
, none
.
type: TagMeta
Determine max tag field width.
type: int
default value: 300
ID of the widget.
type: str
default value: None
You can find this example in our Github repository:
ui-widgets-demos/input/003_input_tag/src/main.py
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Project
ID and TagMeta
we will useInputTag
widgets for each TagMeta
in projectButton
and Text
widgets we will usePrepare a layout for app using Card
widget with the content
parameter and place widget that we've just created in the Container
widget.
Create an app object with layout parameter.
Use the decorators to handle button click and tag values changing. We have button to change tags switch status and text field to show tags values changing.
Parameters | Type | Description |
---|---|---|
Attributes and Methods | Description |
---|---|
tag_meta
TagMeta
TagMeta
from which Tags
will be selected
max_width
int
Max tag field width
widget_id
str
ID of the widget
value
Get input widget value property.
value(value: tag.value)
Set input widget value property.
get_tag_meta()
Return current TagMeta
.
set_tag_meta()
set TagMeta
.
activate()
Activate InputTag
switch.
deactivate()
Deactivate InputTag
switch.
is_active()
Check InputTag
switch is active.
is_valid_value(value: tag.value)
Check InputTag
current value is valid.
set(tag: Union[Tag, None])
Set given value in InputTag
.
get_tag()
Get current Tag
from InputTag
.
@selection_changed
Decorator function is handled when InputTag
selection is changed.
@value_changed
Decorator function is handled when InputTag
value is changed.