Avatar
A circle with initials. index picks one of the theme’s collaborator (player) colors, so the same person keeps the same color; color sets it directly.
ui.avatar · Category: Display · Full reference →


pz.row([ ui.avatar("AL", index=0), ui.avatar("KV", index=1), ui.avatar("MZ", index=2, size=28), ui.avatar("JD", index=3, size=36),], spacing=8, align="center")When to use
Section titled “When to use”- For the account in the title bar, comment authors or collaborators.
- For several people at once use Facepile.
import pyzed as pzfrom pyzed import ui
pz.row([ ui.avatar("AL", index=0), ui.avatar("KV", index=1), ui.avatar("MZ", index=2, size=28), ui.avatar("JD", index=3, size=36),], spacing=8, align="center")Variants
Section titled “Variants”Collaborator color
Section titled “Collaborator color”

index=0Code
ui.avatar("AL", index=0)

index=1Code
ui.avatar("KV", index=1)

index=2Code
ui.avatar("MZ", index=2)

index=3Code
ui.avatar("JD", index=3)

index=4Code
ui.avatar("SR", index=4)

index=5Code
ui.avatar("PB", index=5)

size=18Code
ui.avatar("KV", size=18)

size=22Code
ui.avatar("KV", size=22)

size=32Code
ui.avatar("KV", size=32)

size=48Code
ui.avatar("KV", size=48)

color="#c678dd"Code
ui.avatar("PZ", color="#c678dd", size=32)

color="#e5c07b"Code
ui.avatar("UI", color="#e5c07b", size=32)States and events
Section titled “States and events”image= shows a picture instead of the initials and tooltip= names the person on hover.


status="online"Code
ui.avatar("KK", status="online", size=32)

status="away"Code
ui.avatar("AL", status="away", index=2, size=32)

status="busy"Code
ui.avatar("MZ", status="busy", index=4, size=32)Events
Section titled “Events”Avatar 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 and Events of every component.
Properties and API
Section titled “Properties and API”ui.avatar
Section titled “ui.avatar”avatar( initials, *, color=None, size=22, index=0, image=None, status=None, tooltip=None, theme=None,)A round avatar with initials.
| Property | Default | Description |
|---|---|---|
initials |
required | Initials (the first two are used). |
color |
None |
Background color. |
size |
22 |
Diameter. |
index |
0 |
Picks a collaborator color from the theme (theme.players). |
image |
None |
A picture (path or bytes) instead of the initials. |
status |
None |
Presence dot: "online", "away", "busy", "offline" or a color. |
tooltip |
None |
Text shown on hover (the person’s name). |
theme |
None |
Theme to use instead of the current one (pyzed.theme.current()). |