ClassesListPreview
Last updated
Last updated
Classes List Preview
widget just displays a list of classes. It can be used to display classes that were selected by the user in the Classes List Selector widget for example.
List of ObjClass
objects or Supervisely object class collection (ObjClassCollection
).
type: Union[List[ObjClass], ObjClassCollection]
Set the maximum height of the widget in pixels. If the content exceeds the maximum height, the scroll bar will appear.
type: str
default "128px"
Text that will be displayed when there are no classes in widget
type: str
default None
If True
show name of the shape next to class name.
type: bool
default True
If True
show icon of the shape near class name.
type: bool
default True
ID of the widget.
type: str
default value: None
In this example we will create a mini app with ClassesListPreview
widget. We will create a ClassesListSelector
widget and display selected classes with ClassesListPreview
widget.
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/media/017_classes_list_preview/src/main.py
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
ClassesListSelector
widgetClassesListPreview
widget and Text
widget for displaying number of selected classesPrepare a layout for app using Card
widget with the content
parameter and place widgets that we've previously 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
max_height
bool
Max height of the widget
empty_text
str
Text that will be displayed when there are no classes in widget
show_shape_title
bool
If True
show name of the shape next to class name
show_shape_icon
bool
If True
show icon of the shape near class name
widget_id
str
ID of the widget
set()
Set classes to widget and determine wheter to display shape icon and title.
get()
Return list of classes.