Progress

Download this notebook from GitHub (right-click to download).


In [1]:
import panel as pn
pn.extension()

The Progress widget displays the progress towards some target based on the current value and the max value. If no value is set the Progress widget is in indeterminate mode an will animate depending

For more information about listening to widget events and laying out widgets refer to the widgets user guide. Alternatively you can learn how to build GUIs by declaring parameters independently of any specific widgets in the param user guide. To express interactivity entirely using Javascript without the need for a Python server take a look at the links user guide.

Parameters:

For layout and styling related parameters see the customization user guide.

  • active (boolean): Whether to animate the bar when in indeterminate mode
  • bar_color (str): The color of the bar, one of 'primary', 'secondary', 'success', 'info', 'warn', 'danger', 'light', 'dark'
  • max (int): The maximum progress value
  • style (dict): A dictionary of CSS to apply to the progress bar
  • value (int or None): The current value towards the progress

The Progress widget can be instantiated with and without a value. If given a value the progress bar will fill according to the progress to the max value which is 100 by default:

In [2]:
progress = pn.indicators.Progress(name='Progress', value=20, width=200)
progress
Out[2]:

The progress value can be updated from Python:

In [3]:
progress.value = 80

The Progress can also be instantiated without a value:

In [4]:
indeterminate = pn.indicators.Progress(name='Indeterminate Progress', active=True, width=200)
indeterminate
Out[4]:

The Progress widget also supports a range of bar colors:

In [5]:
running = pn.Column(*[
    pn.Row(pn.panel(bs, width=100), pn.indicators.Progress(width=300, value=10+i*10, bar_color=bs))
        for i, bs in enumerate(pn.indicators.Progress.param.bar_color.objects)
])
running
Out[5]:

Controls

The Progress widget exposes a number of options which can be changed from both Python and Javascript. Try out the effect of these parameters interactively:

In [6]:
pn.Row(progress.controls(jslink=True), progress, indeterminate.controls(jslink=True), indeterminate)
Out[6]:

Download this notebook from GitHub (right-click to download).