Skip to content

Note

Click here to download the full example code

Manual progress bar#

Example of a progress bar being updated manually.

progress manual

Out:

<FunctionGui manual(pbar: magicgui.widgets.ProgressBar = ProgressBar(value=<function match_type.<locals>.<lambda> at 0x1358fd760>, annotation=<class 'magicgui.widgets.ProgressBar'>, name='pbar'), increment: bool = 1)>


from magicgui import magicgui
from magicgui.widgets import ProgressBar


@magicgui(call_button="tick", pbar={"min": 0, "step": 2, "max": 20, "value": 0})
def manual(pbar: ProgressBar, increment: bool = True):
    """Example of manual progress bar control."""
    if increment:
        pbar.increment()
    else:
        pbar.decrement()


manual.show(run=True)

Total running time of the script: ( 0 minutes 0.059 seconds)

Download Python source code: progress_manual.py

Download Jupyter notebook: progress_manual.ipynb

Gallery generated by mkdocs-gallery