# Progress ring

> A round progress bar. A native Pyzed component for Python desktop GUIs, with a live preview, code examples and its API.

Source: https://albakore.github.io/pyzed/library/progress-ring/

:::tip[In plain words]
A circle that fills up to show how much of a task is done.
:::

A ring that fills clockwise from the top as `value` reaches `max`. `show_value` writes the percentage in the middle; `value=None` spins until the task knows how far it is.

`ui.progress_ring` · Category: [Feedback](https://albakore.github.io/pyzed/library/#feedback) · [Full reference →](https://albakore.github.io/pyzed/reference/ui/#progress_ring)

**Code:**

```python
pz.row([
    ui.progress_ring(0.25),
    ui.progress_ring(0.6, size=56, thickness=5, show_value=True),
    ui.progress_ring(1.0, size=56, thickness=5, tint="success", label="Done"),
    ui.progress_ring(None),
], spacing=20, align="center")
```

:::note[New]
This component was added recently. Tell us how it works for you in the [issue tracker](https://github.com/albakore/pyzed/issues).
:::

## When to use

- For a download, an upload or a goal shown in little space.
- In a row of a list, use a small one without text.

## Usage

```python
import pyzed as pz
from pyzed import ui

pz.row([
    ui.progress_ring(0.25),
    ui.progress_ring(0.6, size=56, thickness=5, show_value=True),
    ui.progress_ring(1.0, size=56, thickness=5, tint="success", label="Done"),
    ui.progress_ring(None),
], spacing=20, align="center")
```

## Variants

:::note[About these captures]
Each capture is recorded by pyzed itself, off-screen at 2x, in Pyzed Dark or Pyzed Light to match this site's theme, and cropped to the component so it shows at its real size. The pointer hovers, presses or types into it; a component that does not react to the pointer cycles through a few themes. With reduced motion you see the first frame. Open **Code** under a capture to see the snippet that draws it; free names such as `on_save` stand for your own callbacks.
:::

### Options

```python
ui.progress_ring(0.3)
```

```python
ui.progress_ring(0.72, size=64, thickness=6, show_value=True)
```

```python
ui.progress_ring(3, max=8, size=56, thickness=5, label="3/8")
```

```python
ui.progress_ring(0.45, size=48, tint="warning", show_value=True)
```

### States and events

```python
ui.progress_ring(None, size=40)
```

```python
ui.progress_ring(1, size=48, tint="success", show_value=True)
```

## Events

Progress ring has no events of its own: it shows what you give it. Like every widget it also has the **18 common events** (`click`, `double_click`, `right_click`, `mouse_enter`, `drag`, `key_down`, `resize`…), attached with `.on(...)`: see [Events](https://albakore.github.io/pyzed/guides/events/) and [Events of every component](https://albakore.github.io/pyzed/library/events/).

## Properties and API

### `ui.progress_ring`

```python
progress_ring(
    value,
    *,
    max=1.0,
    size=40,
    thickness=4,
    tint='accent',
    show_value=False,
    label=None,
    theme=None,
)
```

A round progress bar that fills clockwise from the top. `value=None` spins.

| Property | Default | Description |
| --- | --- | --- |
| `value` | *required* | Progress up to `max`, or `None` to spin. |
| `max` | `1.0` | The value of a full ring. |
| `size` | `40` | Diameter in pixels. |
| `thickness` | `4` | Width of the ring. |
| `tint` | `"accent"` | Semantic color: `"accent"`, `"error"`, `"warning"`, `"success"`, `"info"` or a token. |
| `show_value` | `False` | Writes the percentage in the middle. |
| `label` | `None` | Any other text in the middle (`"3/8"`). |
| `theme` | `None` | Theme to use instead of the current one (`pyzed.theme.current()`). |

[Full reference →](https://albakore.github.io/pyzed/reference/ui/#progress_ring)

## Related

- [Progress](https://albakore.github.io/pyzed/library/progress/): A thin progress bar in a semantic color.
- [Spinner](https://albakore.github.io/pyzed/library/spinner/): A spinning arc for loading states.
- [Gauge](https://albakore.github.io/pyzed/library/gauge/): A half-circle meter for one number.
