Docstrings

Introduction

In this tutorial, you will learn how to use the Docstring widget in the Supervisely app. The Docstring widget allows you to display a given docstring as HTML-formatted content.

Read this tutorial in the developer portal.

Function signature

Docstring(
    content="",
    is_html=False,
    widget_id=None,
)
default

Parameters

Parameters
Type
Description

content

str

HTML content

is_html

bool

Determine if the given content has an HTML format

widget_id

str

ID of the widget

content

Determine input HTML content.

type: str

default value: ""

content

is_html

Determine if the given content has an HTML format.

type: bool

default value: False

is_html

widget_id

ID of the widget.

type: str

default value: None

Methods and attributes

Attributes and Methods
Description

set_content(content: str, is_html: bool)

Set Docstring content

get_content()

Return Docstring content

clear()

Clear Docstring content

Mini App Example

You can find this example in our Github repository:

supervisely-ecosystem/ui-widgets-demos/misc/docstring/src/main.py

Import libraries

Init API client

First, we load environment variables with credentials and init API for communicating with Supervisely Instance:

Prepare contents for Docstring widget

You can use 2 types of content:

  • raw docstring as a str type

  • html format string

Initialize Docstring widgets and set content types and values

Create app layout

Prepare a layout for the app using Card widget with the content parameter and place widget that we've just created in the Container widget.

Create app using layout

Create an app object with the layout parameter.

layout

Last updated

Was this helpful?