Progress
Introduction
This Supervisely widget allows you to display the progress of a task or operation. It is a useful widget for applications that involve long-running processes or tasks that take time to complete.
With the Progress Bar
widget, you can easily create a progress bar that updates in real-time or update the progress bar dynamically as a task progresses, giving users a clear indication of how much time is left until the task is complete.
The Progress Bar Widget can be customized to show progress as percents or values.
Function signature
Parameters
Parameters | Type | Description |
---|---|---|
message | str | Progress bar message |
show_percents | bool | Show progress in percents |
hide_on_finish | bool | Hide progress bar on finish |
widget_id | str | ID of the widget |
message
Progress bar message.
type: str
default value: None
show_percents
Show progress in percents.
type: bool
default value: False
hide_on_finish
Hide progress bar on finish
type: bool
default value: True
widget_id
ID of the widget.
type: str
default value: None
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/status elements/001_progress_bar/src/main.py
Import libraries
Init API client
Init API for communicating with Supervisely Instance. First, we load environment variables with credentials:
Initialize Progress Bar
, Text
and Button
widgets
Progress Bar
, Text
and Button
widgetsCreate app layout
Prepare a layout for app using Card
widget with the content
parameter and place 3 widgets that we've just created in the Container
widget. Place order in the Container
is important, we want the finish message text to be displayed below the progress bar button.
Create app using layout
Create an app object with layout parameter.
Our app layout is ready. Progress bar will appear after pressing the Start
button.
Start progress with button click
Use the decorator as shown below to handle button click. Progress Bar
will be updating itself (pbar.update(1)
) every half second by 1 point as specified in sleep
function until it reaches total
10.
Last updated