Ir al contenido

Fila

Coloca sus hijos en horizontal, con spacing entre ellos y align en el eje cruzado. wrap=True pasa a la línea siguiente los hijos que no caben. Las listas se aplanan y se ignoran None/False, así que cond and widget funciona.

pz.row · Categoría: Disposición · Referencia completa →

FilaFila
  • Para barras, grupos de botones, filas de formulario: todo lo que va lado a lado.
  • Separa elementos con pz.hspace() entre ellos.
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("A"), box("B"), box("C")], spacing=8),
pz.row([box("Start"), pz.hspace(), box("End")], spacing=8, width=420),
pz.row([box("tall", h=70), box("center"), box("end")], spacing=8, align="center"),
], spacing=14)
Fila: spacing=0Fila: spacing=0
spacing=0
Código
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"), box("B"), box("C")])
Fila: spacing=8Fila: spacing=8
spacing=8
Código
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"), box("B"), box("C")], spacing=8)
Fila: spacing=24Fila: spacing=24
spacing=24
Código
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"), box("B"), box("C")], spacing=24)
Fila: align="start"Fila: align="start"
align="start"
Código
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("tall", h=70), box("B"), box("C")], spacing=8, align="start")
Fila: align="center"Fila: align="center"
align="center"
Código
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("tall", h=70), box("B"), box("C")], spacing=8, align="center")
Fila: align="end"Fila: align="end"
align="end"
Código
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("tall", h=70), box("B"), box("C")], spacing=8, align="end")
Fila: pz.hspace()Fila: pz.hspace()
pz.hspace()
Código
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("Start"), pz.hspace(), box("End")], width=320)
Fila: wrap=TrueFila: wrap=True
wrap=True
Código
pz.container(pz.row([ui.chip(t) for t in ["python", "rust", "iced", "desktop", "gui", "async", "themes"]],
spacing=6, wrap=True, line_spacing=6), width=260)

Con wrap=True los hijos pasan a nuevas líneas, como etiquetas.

Fila: Salto de líneaFila: Salto de línea

Fila no tiene eventos propios: muestra lo que le das. Como todo widget, también tiene los 18 eventos comunes (click, double_click, right_click, mouse_enter, drag, key_down, resize…), que se conectan con .on(...): mira Eventos y Eventos de cada componente.

row(
children=None,
*,
spacing=0.0,
padding=None,
width=None,
height=None,
align=None,
clip=False,
wrap=False,
line_spacing=None,
)

Coloca los hijos en horizontal.

Propiedad Por defecto Descripción
children None Lista de hijos. Se aplanan listas anidadas y se ignoran None y False, así que puedes escribir cond and widget.
spacing 0.0 Separación entre hijos, en píxeles.
padding None Relleno interior: 8, (vertical, horizontal) o (arriba, derecha, abajo, izquierda).
width None Ancho: píxeles, "fill", "shrink" o "fill:N" (proporción).
height None Alto: píxeles, "fill", "shrink" o "fill:N" (proporción).
align None Alineación de los hijos en el eje cruzado: "start", "center" o "end".
clip False Recorta el contenido que se sale de los límites.
wrap False Ajuste de línea / pasa los hijos a una nueva fila cuando no caben.
line_spacing None Separación entre filas cuando wrap=True.

Referencia completa →