ClassesListPreview
Introduction
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.
Function signature
Parameters
Parameters | Type | Description |
---|---|---|
|
| Supervisely object class collection or list of object classes |
|
| Max height of the widget |
|
| Text that will be displayed when there are no classes in widget |
|
| If |
|
| If |
|
| ID of the widget |
classes
List of ObjClass
objects or Supervisely object class collection (ObjClassCollection
).
type: Union[List[ObjClass], ObjClassCollection]
max_height
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"
empty_text
Text that will be displayed when there are no classes in widget
type: str
default None
show_shape_title
If True
show name of the shape next to class name.
type: bool
default True
show_shape_icon
If True
show icon of the shape near class name.
type: bool
default True
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
Attributes and Methods | Description |
---|---|
| Set classes to widget and determine wheter to display shape icon and title. |
| Return list of classes. |
Mini App Example
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
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 and init ClassesListSelector
widget
ClassesListSelector
widgetInitialize ClassesListPreview
widget and Text
widget for displaying number of selected classes
ClassesListPreview
widget and Text
widget for displaying number of selected classesCreate 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