Skip to content

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 →

AvatarAvatar
  • For the account in the title bar, comment authors or collaborators.
  • For several people at once use Facepile.
import pyzed as pz
from 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")
Avatar: index=0Avatar: index=0
index=0
Code
ui.avatar("AL", index=0)
Avatar: index=1Avatar: index=1
index=1
Code
ui.avatar("KV", index=1)
Avatar: index=2Avatar: index=2
index=2
Code
ui.avatar("MZ", index=2)
Avatar: index=3Avatar: index=3
index=3
Code
ui.avatar("JD", index=3)
Avatar: index=4Avatar: index=4
index=4
Code
ui.avatar("SR", index=4)
Avatar: index=5Avatar: index=5
index=5
Code
ui.avatar("PB", index=5)
Avatar: size=18Avatar: size=18
size=18
Code
ui.avatar("KV", size=18)
Avatar: size=22Avatar: size=22
size=22
Code
ui.avatar("KV", size=22)
Avatar: size=32Avatar: size=32
size=32
Code
ui.avatar("KV", size=32)
Avatar: size=48Avatar: size=48
size=48
Code
ui.avatar("KV", size=48)
Avatar: color="#c678dd"Avatar: color="#c678dd"
color="#c678dd"
Code
ui.avatar("PZ", color="#c678dd", size=32)
Avatar: color="#e5c07b"Avatar: color="#e5c07b"
color="#e5c07b"
Code
ui.avatar("UI", color="#e5c07b", size=32)

image= shows a picture instead of the initials and tooltip= names the person on hover.

Avatar: status="online"Avatar: status="online"
status="online"
Code
ui.avatar("KK", status="online", size=32)
Avatar: status="away"Avatar: status="away"
status="away"
Code
ui.avatar("AL", status="away", index=2, size=32)
Avatar: status="busy"Avatar: status="busy"
status="busy"
Code
ui.avatar("MZ", status="busy", index=4, size=32)

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.

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()).

Full reference →