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

obj_class_view = ObjectClassView(
    obj_class=sly.ObjClass("cat", sly.Bitmap, [255, 0, 0]),
    show_shape_text=True,
    show_shape_icon=True,
    widget_id=None
)
objclass-default

Parameters

Parameters
Type
Description

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

objclass-show-text

show_shape_icon

Display object class icon

type: bool

default value: False

objclass-show-icon

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

Get Project info and meta from server

Prepare ObjClass for each class in project

Prepare dictionary to get geometry type by geometry name

create ObjClass for each class in project

Create ObjClassCollection from ObjClasses

Initialize ObjectClassView widget

In 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.

objclassview-app

Last updated

Was this helpful?