ClassesListSelector
Introduction
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.
Function signature
Parameters
Parameters | Type | Description |
---|---|---|
|
| Supervisely object class collection or list of object classes |
|
| Enable multiple classes selection |
|
| Notification that will be displayed when there are no classes in widget |
|
| ID of the widget |
classes
List of ObjClass
objects or Supervisely object class collection (ObjClassCollection
).
type: Union[List[ObjClass], ObjClassCollection]
multiple
If True
then multiple classes can be selected. Otherwise, only one class can be selected.
type: bool
default False
empty_notification
Notification that will be displayed when there are no classes in widget
type: NotificationBox
default None
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
Attributes and Methods | Description |
---|---|
| Set classes to widget. |
| Return list of selected classes. |
| Select all classes. |
| Deselect all classes. |
| Select classes by names. |
| Deselect classes by names. |
| Set multiple flag. |
| Return list of all classes. |
| Callback triggers when selection is changed. |
Mini App Example
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/selection/016_classes_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 object classes
Initialize ClassesListSelector
widget, NotificationBox
widget for custom notification and Text
widget for displaying selected classes count
ClassesListSelector
widget, NotificationBox
widget for custom notification and Text
widget for displaying selected classes 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