ClassesListSelector
Last updated
Last updated
Classes List Selector
widget allows users to view a list of object classes and change it dynamically using widget methods. This widget can be used for visualizing and selecting classes in Supervisely.
List of ObjClass
objects or Supervisely object class collection (ObjClassCollection
).
type: Union[List[ObjClass], ObjClassCollection]
If True
then multiple classes can be selected. Otherwise, only one class can be selected.
type: bool
default False
Notification that will be displayed when there are no classes in widget
type: NotificationBox
default None
ID of the widget.
type: str
default value: None
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/selection/016_classes_list_selector/src/main.py
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
ClassesListSelector
widget, NotificationBox
widget for custom notification and Text
widget for displaying selected classes countPrepare a layout for app using Card
widget with the content
parameter and place widget that we've just created into the Container
widget.
Create an app object with layout parameter.
Parameters | Type | Description |
---|---|---|
Attributes and Methods | Description |
---|---|
classes
Union[List[ObjClass], ObjClassCollection]
Supervisely object class collection or list of object classes
multiple
bool
Enable multiple classes selection
empty_notification
NotificationBox
Notification that will be displayed when there are no classes in widget
widget_id
str
ID of the widget
set()
Set classes to widget.
get_selected_classes()
Return list of selected classes.
select_all()
Select all classes.
deselect_all()
Deselect all classes.
select()
Select classes by names.
deselect()
Deselect classes by names.
set_multiple()
Set multiple flag.
get_all_classes()
Return list of all classes.
@selection_changed
Callback triggers when selection is changed.