# Ejemplos

> Apps de ejemplo de Pyzed listas para ejecutar: listas de tareas, un editor de código, el Juego de la vida, reloj, cronómetro, varias ventanas y datos en vivo.

Source: https://albakore.github.io/pyzed/es/examples/

Todos los ejemplos están en [`examples/`](https://github.com/albakore/pyzed/tree/main/examples).
Ejecútalos desde la raíz del repositorio:

.py
`}
python={`
{py} -m pip install pyzed-ui
{py} examples/<nombre>.py
`}
/>

| Ejemplo | Qué muestra | Tutorial |
| --- | --- | --- |
| [`counter.py`](https://github.com/albakore/pyzed/blob/main/examples/counter.py) | Lo mínimo: estado, mensajes y callables. | [Inicio rápido](https://albakore.github.io/pyzed/es/getting-started/quickstart/) |
| [`todo.py`](https://github.com/albakore/pyzed/blob/main/examples/todo.py) | Formularios, listas, filtros, foco y atajos. | [Lista de tareas](https://albakore.github.io/pyzed/es/tutorials/basic/todo-app/) |
| [`downloads.py`](https://github.com/albakore/pyzed/blob/main/examples/downloads.py) | `Command.perform`, `pz.post` desde hilos, progreso y notificaciones. | [Tareas en segundo plano](https://albakore.github.io/pyzed/es/tutorials/intermediate/background-tasks/) |
| [`mini_editor.py`](https://github.com/albakore/pyzed/blob/main/examples/mini_editor.py) | Un editor de código con árbol de archivos y pestañas en ~150 líneas. | [Mini editor](https://albakore.github.io/pyzed/es/tutorials/advanced/code-editor/) |
| [`gallery.py`](https://github.com/albakore/pyzed/blob/main/examples/gallery.py) | Todos los componentes, interactivos, con selector de tema. | [Componentes](https://albakore.github.io/pyzed/es/components/overview/) |
| [`zed_editor.py`](https://github.com/albakore/pyzed/blob/main/examples/zed_editor.py) | Editor completo: buscador de archivos, paleta, docks, terminal, temas y marcadores de git. | |
| [`tutorial/`](https://github.com/albakore/pyzed/tree/main/examples/tutorial/) | Cinco pasos: ventana, estado, layout y temas, async, app de notas. | [Tutorial en 5 pasos](https://albakore.github.io/pyzed/es/tutorials/basic/step-by-step/) |
| [`todos.py`](https://github.com/albakore/pyzed/blob/main/examples/todos.py) | Las *todos* de Iced: añadir, editar, completar, filtrar y guardar. |  |
| [`game_of_life.py`](https://github.com/albakore/pyzed/blob/main/examples/game_of_life.py) | `pz.canvas` con miles de celdas y `pz.every` como motor. | [Canvas](https://albakore.github.io/pyzed/es/guides/canvas/) |
| [`games/snake.py`](https://github.com/albakore/pyzed/blob/main/examples/games/snake.py) | Snake con temporizador fijo, cola de teclas y tarjeta de cristal de game over. | [Snake](https://albakore.github.io/pyzed/es/games/snake/) |
| [`games/breakout.py`](https://github.com/albakore/pyzed/blob/main/examples/games/breakout.py) | Bucle a 60 fps con `pz.frames`, teclas mantenidas, colisiones, partículas y temblor. | [Breakout](https://albakore.github.io/pyzed/es/games/breakout/) |
| [`games/neon_invaders.py`](https://github.com/albakore/pyzed/blob/main/examples/games/neon_invaders.py) | Un shooter espacial: sprites pixel art, brillo neón y un HUD con cristal y bloom. | [Neon Invaders](https://albakore.github.io/pyzed/es/games/neon-invaders/) |
| [`clock.py`](https://github.com/albakore/pyzed/blob/main/examples/clock.py) | Reloj analógico dibujado en un canvas. | [Canvas](https://albakore.github.io/pyzed/es/guides/canvas/) |
| [`stopwatch.py`](https://github.com/albakore/pyzed/blob/main/examples/stopwatch.py) | Cronómetro con vueltas y atajos. | [Async](https://albakore.github.io/pyzed/es/guides/async/) |
| [`download_progress.py`](https://github.com/albakore/pyzed/blob/main/examples/download_progress.py) | Descargas concurrentes con generadores `async` y progreso. | [Async](https://albakore.github.io/pyzed/es/guides/async/) |
| [`websocket_stream.py`](https://github.com/albakore/pyzed/blob/main/examples/websocket_stream.py) | Datos en vivo con `pz.listen` y un generador `async`. | [Async](https://albakore.github.io/pyzed/es/guides/async/) |
| [`multi_window.py`](https://github.com/albakore/pyzed/blob/main/examples/multi_window.py) | Varias `pz.Window` con estado compartido y temas distintos. | [Varias ventanas](https://albakore.github.io/pyzed/es/guides/windows/) |
| [`styling.py`](https://github.com/albakore/pyzed/blob/main/examples/styling.py) | Selector de temas, modo del sistema, `Theme.generate` y acentos. | [Temas](https://albakore.github.io/pyzed/es/theming/themes/) |
| [`image_viewer.py`](https://github.com/albakore/pyzed/blob/main/examples/image_viewer.py) | `pz.image` y el visor con zoom `pz.image_viewer`. | [Contenido](https://albakore.github.io/pyzed/es/components/content/#imágenes) |
| [`markdown_viewer.py`](https://github.com/albakore/pyzed/blob/main/examples/markdown_viewer.py) | Editor de Markdown con vista previa en vivo. | [Contenido](https://albakore.github.io/pyzed/es/components/content/) |
| [`qr_code.py`](https://github.com/albakore/pyzed/blob/main/examples/qr_code.py) | Genera un código QR mientras escribes. | [Contenido](https://albakore.github.io/pyzed/es/components/content/) |
| [`panes.py`](https://github.com/albakore/pyzed/blob/main/examples/panes.py) | Paneles redimensionables con `ui.split` anidados. | [Contenido](https://albakore.github.io/pyzed/es/components/content/#paneles-redimensionables) |
| [`context_menu.py`](https://github.com/albakore/pyzed/blob/main/examples/context_menu.py) | Menú contextual con `ui.popover` y `ui.menu`. | [Contenido](https://albakore.github.io/pyzed/es/components/content/#popover) |
| [`screenshots.py`](https://github.com/albakore/pyzed/blob/main/examples/screenshots.py) | Regenera las capturas de la documentación. | [Tests y capturas](https://albakore.github.io/pyzed/es/guides/testing/) |

## Integraciones

[`examples/integrations/`](https://github.com/albakore/pyzed/tree/main/examples/integrations) reúne
apps de escritorio hechas con librerías de backend y de datos. Cada una es un proyecto de uv: entra
en su carpeta y ejecuta `uv run main.py`.

| Ejemplo | Librerías | Tutorial |
| --- | --- | --- |
| [`fastapi_heroes`](https://github.com/albakore/pyzed/tree/main/examples/integrations/fastapi_heroes) | FastAPI, SQLModel, httpx | [FastAPI](https://albakore.github.io/pyzed/es/integrations/fastapi/) |
| [`django_polls`](https://github.com/albakore/pyzed/tree/main/examples/integrations/django_polls) | Django, httpx | [Django](https://albakore.github.io/pyzed/es/integrations/django/) |
| [`sqlalchemy_quickstart`](https://github.com/albakore/pyzed/tree/main/examples/integrations/sqlalchemy_quickstart) | SQLAlchemy 2.0, aiosqlite | [SQLAlchemy](https://albakore.github.io/pyzed/es/integrations/sqlalchemy/) |
| [`sqlalchemy_contacts`](https://github.com/albakore/pyzed/tree/main/examples/integrations/sqlalchemy_contacts) | SQLAlchemy 2.0 | [SQLAlchemy](https://albakore.github.io/pyzed/es/integrations/sqlalchemy/#muchas-filas-la-demo-de-contactos) |
| [`sqlmodel_heroes`](https://github.com/albakore/pyzed/tree/main/examples/integrations/sqlmodel_heroes) | SQLModel | [SQLModel](https://albakore.github.io/pyzed/es/integrations/sqlmodel/) |
| [`sqlmodel_inventory`](https://github.com/albakore/pyzed/tree/main/examples/integrations/sqlmodel_inventory) | SQLModel, Pydantic | [SQLModel](https://albakore.github.io/pyzed/es/integrations/sqlmodel/#un-modelo-para-el-formulario-y-la-tabla-la-demo-de-inventario) |
| [`httpx_pypi`](https://github.com/albakore/pyzed/tree/main/examples/integrations/httpx_pypi) | httpx, Pydantic | [httpx](https://albakore.github.io/pyzed/es/integrations/httpx/) |
| [`httpx_download`](https://github.com/albakore/pyzed/tree/main/examples/integrations/httpx_download) | httpx | [httpx](https://albakore.github.io/pyzed/es/integrations/httpx/#descargas-en-streaming-con-progreso) |
| [`pydantic_signup`](https://github.com/albakore/pyzed/tree/main/examples/integrations/pydantic_signup) | Pydantic | [Pydantic](https://albakore.github.io/pyzed/es/integrations/pydantic/) |
| [`aiosqlite_journal`](https://github.com/albakore/pyzed/tree/main/examples/integrations/aiosqlite_journal) | aiosqlite | [Otras librerías](https://albakore.github.io/pyzed/es/integrations/other-libraries/#aiosqlite) |

## Editor de código

Atajos: <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> paleta, <kbd>Ctrl</kbd>+<kbd>P</kbd>
buscador de archivos, <kbd>Ctrl</kbd>+<kbd>S</kbd> guardar, <kbd>Ctrl</kbd>+<kbd>B</kbd>,
<kbd>Ctrl</kbd>+<kbd>J</kbd> y <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>B</kbd> docks.

(Image: Un editor de código hecho con Pyzed, en One Dark)

| Paleta de comandos | Buscador de archivos (Gruvbox) |
| --- | --- |
| (Image: Paleta) | (Image: Buscador) |

## Galería de componentes

(Image: Galería en One Light)

## Descargas

(Image: Descargas)

## Demos de Iced

Recreaciones en Python de las [demos de Iced](https://github.com/iced-rs/iced/tree/master/examples).

| Game of Life | Estilos |
| --- | --- |
| (Image: Game of Life) | (Image: Estilos) |

| Reloj | Cronómetro |
| --- | --- |
| (Image: Reloj) | (Image: Cronómetro) |

| Todos | Código QR |
| --- | --- |
| (Image: Todos) | (Image: Código QR) |

| Visor de imágenes | Markdown |
| --- | --- |
| (Image: Visor de imágenes) | (Image: Markdown) |

### Varias ventanas

(Image: Varias ventanas)

## IA y Bloques

| Ejemplo | Qué muestra | Página |
| --- | --- | --- |
| [`ai_chat.py`](https://github.com/albakore/pyzed/blob/main/examples/ai_chat.py) | Un chat con IA en streaming sobre cualquier API compatible con OpenAI, con un modo demo que no necesita red. | [Crear apps con IA](https://albakore.github.io/pyzed/es/ai/ai-apps/) |
| [`pomodoro.py`](https://github.com/albakore/pyzed/blob/main/examples/pomodoro.py) | El temporizador que construye un agente con las herramientas MCP en la guía de prompts. | [Guía de prompts](https://albakore.github.io/pyzed/es/ai/prompting/) |
| [`blocks/`](https://github.com/albakore/pyzed/tree/main/examples/blocks) | Nueve pantallas listas: login, dashboard, ajustes, tabla de datos, chat, IDE, bienvenida, reproductor de música y kanban. | [Bloques](https://albakore.github.io/pyzed/es/blocks/) |

Las capturas de esta página se generan con `python docs/scripts/example_shots.py`.
