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
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
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
set()
Set classes to widget and determine wheter to display shape icon and title.
get()
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