Dialog

Introduction

Dialog is a widget that allows to show a dialog window that contain any other widgets. It can be used to show a message to the user or to ask for confirmation.

Read this tutorial in developer portal.

Function signature

dialog = Dialog(
    title = "Dialog Window",
    content = None,
    size = "small",
)

Parameters

Parameters
Type
Description

title

str

Title of the dialog window

content

Widget

Widget to display in dialog window

size

Literal["tiny", "small", "large", "full"] = "small"

Size of the dialog window

widget_id

str

ID of the widget

title

Title of the dialog window that will be displayed in the header.

type: str

default value: ""

content

Widget to display in the dialog window. Use Container widget to display multiple widgets.

type: Widget

default value: None

size

Width of the annotation border (contour) line. Set to 0 to hide a line.

type: Literal["tiny", "small", "large", "full"]

default value: "small"

widget_id

ID of the widget.

type: str

default value: None

Methods and attributes

Attributes and Methods
Description

show()

Open (show) dialog window.

hide()

Close (hide) dialog window.

title

Set title for dialog window

Mini App Example

You can find this example in our Github repository: supervisely-ecosystem/ui-widgets-demos/layouts and containers/016_dialog/src/main.py

Import libraries

Init API client

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

Initialize content widgets for Dialog

Initialize Dialog widget

Create button to open Dialog

Create app layout

Prepare a layout for app using Card widget with the content parameter and place Button for opening dialog to the content.

Create app using layout

Add Container widget with card and dialog widgets to the app layout.

Add button click event to update open and close Dialog

Last updated

Was this helpful?