ClassesMappingPreview
Last updated
Last updated
Classes List Preview
widget displays classes mapping. It can be used to display new names of classes that were edited by the user in the Classes Mapping widget for example.
classes
Union[List[ObjClass], ObjClassCollection]
Supervisely object class collection or list of object classes
mapping
Dict[str,str]
Dictionary where keys are class names and values are new names.
max_height
str
Text that will be displayed when there are no classes in widget
widget_id
str
ID of the widget
List of ObjClass
objects or Supervisely object class collection (ObjClassCollection
).
type: Union[List[ObjClass], ObjClassCollection]
Dictionary where keys are original class names and values are new names.
type: Dict[str,str]
default None
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"
ID of the widget.
type: str
default value: None
set()
Set classes and mapping to widget.
set_mapping()
Set new mapping.
get_mapping()
Return current class mapping.
get_classes()
Return list of classes.
In this example we will create a mini app with ClassesMappingPreview
widget. We will create a ClassesMapping
widget and display changed classes with ClassesMappingPreview
widget.
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/media/016_classes_mapping_preview/src/main.py
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
ClassesMapping
widgetClassesMappingPreview
widget and Button
widget for saving and displaying mappingPrepare 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.