NotificationBox

Introduction

NotificationBox is a widget to display messages to the user. It immediately attracts the user's attention and can be used to inform the user about important events, such as the successful completion of a task, errors during execution, or the need to make adjustments to the annotation. NotificationBox supports various levels of messages, such as informational, success, warning, and error.

Function signature

note_box = NotificationBox(
    title="Notification Box",
    description="Lorem ipsum dolor sit amet...",
    box_type="info",
    widget_id=None
)

Parameters

Parameters
Type
Description

title

str

Main title of notification box

description

str

Description text

box_type

Literal["success", "info", "warning", "error"]

Notification box style

widget_id

str

ID of the widget

title

Main title of notification box

type: str

default value: None

description

Description text

type: str

default value: None

box_type

Parameter to change notification style

type: Literal["success", "info", "warning", "error"]

default value: "info"

widget_id

ID of the widget.

type: str

default value: None

Methods and attributes

Attributes and Methods
Description

title

Get or set notification box title property.

description

Get or set notification box description property.

set(title: str, description: str)

Set title and description properties.

Mini App Example

You can find this example in our Github repository:

ui-widgets-demos/status elements/002_notification_box/src/main.py

Import libraries

Init API client

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

Initialize NotificationBox widget

In this tutorial we will use 4 types of notification box.

Create app layout

For 1 example we will create project and show notication with info box type

For 2 example we will use Progress widget and show success box type notification.

Create buttons for error and warning box type notifications.

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

Create app using layout

Create an app object with layout parameter.

Add functions to control widgets from python code

Last updated

Was this helpful?