ObjectClassView
Introduction
ObjectClassView
is a widget in Supervisely that displays a single object class and provides a convenient way to view the name, color, as well as the icon and shape type of the class.
Function signature
Parameters
obj_class
ObjClass
Supervisely object class
show_shape_text
bool
If True
display shape text
show_shape_icon
bool
If True
display shape icon
widget_id
str
ID of the widget
obj_class
Supervisely object class
type: ObjClass
show_shape_text
Display shape text of object class
type: bool
default value: True
show_shape_icon
Display object class icon
type: bool
default value: False
widget_id
ID of the widget.
type: str
default value: None
Mini App Example
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/media/009_object_class_view/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Initialize Project ID
we will use
Project ID
we will useGet Project info and meta from server
Prepare ObjClass
for each class in project
ObjClass
for each class in projectPrepare dictionary to get geometry type by geometry name
create ObjClass for each class in project
Create ObjClassCollection
from ObjClasses
ObjClassCollection
from ObjClassesInitialize ObjectClassView
widget
ObjectClassView
widgetIn this tutorial we will create list of ObjectClassView
objects for each class in project.
Create app layout
Prepare a layout for app using Card
, Field
widgets with the content
parameter and place widgets that we've just created in the Container
widget.
Create app using layout
Create an app object with layout parameter.
Last updated