Skip to content

Commit

Permalink
Update user_experience.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuang11 authored Sep 19, 2024
1 parent 2798e35 commit fbe6327
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions doc/how_to/best_practices/user_experience.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,19 @@ pn.state.onload(onload)

### Good

Set `loading=pn.state.param.busy` to overlay a spinner while processing to let the user know it's working.

```{pyodide}
def process_load(event):
time.sleep(3)
button = pn.widgets.Button(name="Click me", on_click=process_load)
widget_box = pn.WidgetBox(button, loading=pn.state.param.busy, height=300, width=300)
widget_box
```

### Good

Set `loading=True` to show a spinner while processing to let the user know it's working.

```{pyodide}
Expand Down Expand Up @@ -193,8 +206,6 @@ Use:
- `finally` block to update values regardless

```{pyodide}
import time
def compute(divisor):
try:
busy.value = True
Expand Down

0 comments on commit fbe6327

Please sign in to comment.