ui.Progress
self, min=0, max=1, session=None) ui.Progress(
Initialize a progress bar.
Progress
creates a computation manager that can be used with with
to run a block of code. Shiny will display a progress bar while the code runs, which you can update by calling the set()
and message()
methods of the computation manager at strategic points in the code block.
Parameters
min : int = 0
-
The value that represents the starting point of the progress bar. Must be less than
max
. max : int = 1
-
The value that represents the end of the progress bar. Must be greater than
min
. session : Optional[Session] = None
-
The Session instance that the progress bar should appear in. If not provided, the session is inferred via get_current_session.
Examples
Methods
Name | Description |
---|---|
close | Close the progress bar. You can also use the Progress object as a context manager, which will cause the progress bar to close on exit. |
inc | Increment the progress bar. |
set | Opens and updates the progress panel. |
close
ui.Progress.close()
Close the progress bar. You can also use the Progress object as a context manager, which will cause the progress bar to close on exit.
Parameters
self :
-
The object instance
Note
Removes the progress panel. Future calls to set and close will be ignored.
inc
=0.1, message=None, detail=None) ui.Progress.inc(amount
Increment the progress bar.
Like set
, this updates the progress panel. The difference is that inc
increases the progress bar by amount, instead of setting it to a specific value.
Parameters
self :
-
The object instance
amount : float = 0.1
-
The amount to increment in progress.
message : Optional[str] = None
-
The message to be displayed to the user or
None
to hide the current message (if any). detail : Optional[str] = None
-
The detail message to be displayed to the user or
None
to hide the current detail message (if any). The detail message will be shown with a de-emphasized appearance relative to message.
set
set(value=None, message=None, detail=None) ui.Progress.
Opens and updates the progress panel.
When called the first time, the progress panel is displayed.
Parameters
self :
-
The object instance
value : Optional[float] = None
-
The value at which to set the progress bar, relative to
min
andmax
.None
hides the progress bar, if it is currently visible. message : Optional[str] = None
-
The message to be displayed to the user or
None
to hide the current message (if any). detail : Optional[str] = None
-
The detail message to be displayed to the user or
None
to hide the current detail message (if any). The detail message will be shown with a de-emphasized appearance relative to message.