Skip to content

Commit

Permalink
fix: doc demo of put_loading() error
Browse files Browse the repository at this point in the history
  • Loading branch information
wang0618 committed Jun 15, 2021
1 parent dd2e8a6 commit 8a957b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions demos/doc_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
from functools import partial
from os import path, listdir
import time

from pywebio import start_server
from pywebio.output import *
Expand Down
3 changes: 2 additions & 1 deletion pywebio/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 8a957b4

Please sign in to comment.