Displays task progress on a horizontal graphical bar. The task being monitored can be of known or indeterminate length.
If a progress bar has a
max value, it is a determinate progress bar. The
value of the progress bar can be altered over time, indicating progress on a
task. The visual indicator of the progress bar will be filled indicating the
value relative to
max can be any positive
import toga progress = toga.ProgressBar(max=100, value=1) # Start progress animation progress.start() # Update progress to 10% progress.value = 10 # Stop progress animation progress.stop()
If a progress bar does not have a
max value (i.e.,
max == None), it is
an indeterminate progress bar. Any change to the value of an indeterminate
progress bar will be ignored. When started, an indeterminate progress bar
animates as a throbbing or “ping pong” animation.
import toga progress = toga.ProgressBar(max=None) # Start progress animation progress.start() # Stop progress animation progress.stop()
The visual appearance of progress bars varies from platform to platform. Toga will try to provide a visual distinction between running and not-running determinate progress bars, but this cannot be guaranteed.
- class toga.widgets.progressbar.ProgressBar(id=None, style=None, max=1.0, value=0.0, running=False)#
Create a new Progress Bar widget.
id – The ID for the widget.
style – A style object. If no style is provided, a default style will be applied to the widget.
max – The value that represents completion of the task. Must be > 0.0; defaults to 1.0. A value of
Noneindicates that the task length is indeterminate.
value – The current progress against the maximum value. Must be between 0.0 and
max; any value outside this range will be clipped. Defaults to 0.0.
running – Describes whether the indicator is running at the time it is created. Default is False.
- property enabled#
Is the widget currently enabled? i.e., can the user interact with the widget?
ProgressBar widgets cannot be disabled; this property will always return True; any attempt to modify it will be ignored.
- property is_determinate#
Describe whether the progress bar has a known or indeterminate maximum.
True if the progress bar has determinate length; False otherwise.
- property is_running#
Describe if the activity indicator is currently running.
stop()to change the running state.
True if this activity indicator is running; False otherwise.
- property max#
The value indicating completion of the task being monitored.
Must be a number > 0, or
Nonefor a task of indeterminate length.
Start the progress bar.
If the progress bar is already started, this is a no-op.
Stop the progress bar.
If the progress bar is already stopped, this is a no-op.
- property value#
The current value of the progress indicator.
If the progress bar is determinate, the value must be between 0 and
max. Any value outside this range will be clipped.
If the progress bar is indeterminate, changes in value will be ignored, and the current value will be returned as