-
Notifications
You must be signed in to change notification settings - Fork 129
/
status.md
67 lines (55 loc) · 1.3 KB
/
status.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Status
Use progress bars or spinners to visualize loading status in your notebooks and
apps. Useful when iterating over collections or loading data from files,
databases, or APIs.
## Progress bar
You can display a progress bar while iterating over a collection, similar
to `tqdm`.
```{eval-rst}
.. marimo-embed::
:size: medium
@app.cell
def __():
rerun = mo.ui.button("Rerun")
rerun
return
@app.cell
async def __():
import asyncio
rerun
for _ in mo.status.progress_bar(
range(10),
title="Loading",
subtitle="Please wait",
show_eta=True,
show_rate=True
):
await asyncio.sleep(0.5)
return
```
```{eval-rst}
.. autofunction:: marimo.status.progress_bar
```
## Spinner
```{eval-rst}
.. marimo-embed::
:size: medium
@app.cell
def __():
rerun = mo.ui.button("Rerun")
rerun
return
@app.cell
async def __():
import asyncio
rerun
with mo.status.spinner(title="Loading...") as _spinner:
await asyncio.sleep(1)
_spinner.update("Almost done")
await asyncio.sleep(1)
_spinner.update("Done")
return
```
```{eval-rst}
.. autofunction:: marimo.status.spinner
```