Skip to main content

Progress Bar

Sometimes, data processing may take a long time to load, process, or save. A progress bar provides useful feedback to the user. Here’s an example:

from time import sleep
from abstra.forms import run, ProgressOutput

def show_progress_bar(state):
for i in range(1, 11):
sleep(1) # Simulating a time-consuming process
yield [ProgressOutput(current=i, total=10)]

run([show_progress_bar])

info
  • Use yield instead of return to allow the function to continue running.
  • You can yield any type of output widget dynamically.