DoneLabel
is a widget in Supervisely that is used to display messages about completed tasks or operations.
It is a minimalist text element that displays a green "Done" checkmark with the message next to it. DoneLabel
is usually used to inform the user that a task has been successfully completed or that a process is finished.
done_label = DoneLabel(
text="Task has been successfully finished",
widget_id=None
)
Parameters | Type | Description |
---|---|---|
text |
str |
Description text |
widget_id |
str |
ID of the widget |
Description text
type: str
default value: None
done_label = DoneLabel(text="Some text")
ID of the widget.
type: str
default value: None
Attributes and Methods | Description |
---|---|
text |
Get or set text property. |
You can find this example in our Github repository:
ui-widgets-demos/status elements/003_done_label/src/main.py
import os
from time import sleep
import supervisely as sly
from dotenv import load_dotenv
from supervisely.app.widgets import Button, Card, Container, DoneLabel
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
load_dotenv("local.env")
load_dotenv(os.path.expanduser("~/supervisely.env"))
api = sly.Api()
done_label = DoneLabel(
text="Task has been successfully finished",
)
In this tutorial we will use Button
, Progress
widgets for demo.
done_label.hide()
progress = sly.app.widgets.Progress()
start_btn = Button(text="START")
Prepare a layout for app using Card
widget with the content
parameter and place widgets that we've just created in the Container
widget.
container = Container(widgets=[start_btn, progress, done_label])
card = Card(
title="Done Label",
content=container,
)
layout = Container(widgets=[card])
Create an app object with layout parameter.
app = sly.Application(layout=layout)
@start_btn.click
def start_progress():
done_label.hide()
with progress(message="Processing...", total=5) as pbar:
for _ in range(5):
sleep(1)
pbar.update(1)
done_label.show()