diff --git a/demos/doc_demo.py b/demos/doc_demo.py index 31090100..ea3b4587 100644 --- a/demos/doc_demo.py +++ b/demos/doc_demo.py @@ -3,6 +3,7 @@ """ from functools import partial from os import path, listdir +import time from pywebio import start_server from pywebio.output import * diff --git a/pywebio/output.py b/pywebio/output.py index 9fa65481..794ff5a1 100644 --- a/pywebio/output.py +++ b/pywebio/output.py @@ -904,7 +904,8 @@ def put_loading(shape='border', color='dark', scope=Scope.Current, position=Outp put_loading(shape=shape, color=color) ## ---- - # Use as context manager + import time # ..demo-only + # Use as context manager, the loading prompt will disappear automatically when the context block exits. with put_loading(): time.sleep(3) # Some time-consuming operations put_text("The answer of the universe is 42")