Skip to content

Space

pz.space(width, height) is an empty box of a given size. pz.hspace() and pz.vspace() are flexible gaps that take the free space, pushing their siblings to the edges of a row or column.

pz.space · Category: Layout · Full reference →

SpaceSpace
  • To push actions to the right of a toolbar, or a footer to the bottom of a panel.
import pyzed as pz
from pyzed import ui
box = lambda text, w=90, h=44: pz.container(ui.label(text), center=True, width=w, height=h, bg=pz.theme.current().element, radius=6)
pz.column([
pz.row([box("left"), pz.hspace(), box("right")], width=440),
pz.row([box("a"), pz.space(width=60), box("60 px later", w=140)]),
], spacing=16)
Space: pz.hspace()Space: pz.hspace()
pz.hspace()
Code
box = lambda text, w=90, h=44: pz.container(ui.label(text), center=True, width=w, height=h, bg=pz.theme.current().element, radius=6)
pz.row([box("left"), pz.hspace(), box("right")], width=320)
Space: pz.space(width=60)Space: pz.space(width=60)
pz.space(width=60)
Code
box = lambda text, w=90, h=44: pz.container(ui.label(text), center=True, width=w, height=h, bg=pz.theme.current().element, radius=6)
pz.row([box("a"), pz.space(width=60), box("b")])
Space: pz.vspace()Space: pz.vspace()
pz.vspace()
Code
box = lambda text, w=90, h=44: pz.container(ui.label(text), center=True, width=w, height=h, bg=pz.theme.current().element, radius=6)
pz.column([box("top"), pz.vspace(), box("bottom")], height=150)

Space 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.

space(width=None, height=None)

Empty space of a given size.

Property Default Description
width None Width: pixels, "fill", "shrink" or "fill:N" (proportion).
height None Height: pixels, "fill", "shrink" or "fill:N" (proportion).

Full reference →

hspace(width='fill')

Flexible horizontal gap: pushes the siblings in a row towards the edges.

Property Default Description
width "fill" Width: pixels, "fill", "shrink" or "fill:N" (proportion).

Full reference →

vspace(height='fill')

Flexible vertical gap: pushes the siblings in a column towards the edges.

Property Default Description
height "fill" Height: pixels, "fill", "shrink" or "fill:N" (proportion).

Full reference →