Skip to content

The Form view

A form is one window of your app. The Form view is where you draw it: you pick controls from a box, drop them on the window, change their look in a list of properties, and write a few lines of Python for what happens when the user clicks or types. If you have used Visual Basic, the WinForms designer or Qt Designer, you already know the idea; if you haven’t, the walkthrough below takes ten minutes.

Area In the Form view
Toolbox (left, top) Every control you can place, grouped (Common, Display, Containers, Layout, Navigation…), with a search box.
Outline (left, bottom) The controls of the form as a tree: select, rename, nest, hide and lock them.
Toolbar (center, top) Save, undo, align, distribute, same size, center, order, grid, snap and guides.
Canvas (center) The form inside a window frame, as it will run.
Properties (right) The selected control, or the form when nothing is selected.
Events (right) What the selected control can react to, and the Python function wired to each event.
Code (bottom) The Python of the form, opened when you wire an event.
The Form view with a sign-in form: toolbox and outline on the left, the form on the canvas, the properties of the selected button on the rightThe Form view with a sign-in form: toolbox and outline on the left, the form on the canvas, the properties of the selected button on the right
The Form view with the sign-in example open and its button selected.

Every area is described in detail in its own page: Toolbox and canvas, Properties, Events and Code editor.

You will build a window with a text box, a button and a label. Typing a name and clicking the button shows “Hello, name!”.

A button, a text box and a check box dragged one by one from the toolbox onto an empty form
Placing controls: drag them from the toolbox and drop them on the form.
  1. Create the form. Press Ctrl+N. In the New dialog keep Form, type hello as the Name and Greeter as the Title, pick the Blank template and press Create. Two files appear: hello.pzform (the layout) and hello.py (the code).

    The New dialog with a name, title, folder and templates
    The New dialog: name, title, folder and a template to start from.
  2. Place a text box. In the toolbox, drag Text box onto the form. It is selected and the Properties panel shows it. Change its Name to your_name and its Placeholder to Your name.

  3. Place a button. Click Button in the toolbox, then drag a rectangle on the form under the text box: the button takes that size. Name it greet and set its Text to Say hello.

    Placing a button by dragging a rectangle with the tool picked
    With a control picked, drag a rectangle to give it a size.
  4. Place a label. Add a Label under the button, name it message and clear its text.

  5. Line them up. Select the three controls (drag a rubber band around them) and press Align left in the toolbar. Smart guides show pink lines when edges line up while you drag.

  6. Wire the click. Double-click the button. The Events panel wires its click event to a new function, greet_click, and opens it in the code editor. Write one line:

    hello.py
    def greet_click(form, event):
    """Runs when greet is clicked."""
    form.message.text = f"Hello, {form.your_name.text}!"

    form is the running window: each control is an attribute with its name (form.message), and its properties are attributes of the control (form.message.text). Changing them updates the window.

    The Events panel with an event wired to a handler
    The Events panel: double-click an event to wire it and jump to its code.
  7. Run it. Press F5 (it saves first). Your form opens as a real window; type a name and click the button. The console at the bottom shows what the form prints and any error. Keep it open, change the label’s color in Properties and save: the running window updates.

    The form running in its own window next to the designer
    F5 runs the form with its code; saving updates it live.

The form and its code are ordinary files of your project. Run them from a terminal:

Terminal window
uv run pyzed run hello.pzform
uv run pyzed run hello.pzform --reload # updates on every save

Or from your own Python code:

main.py
from pyzed import designer
designer.run("hello.pzform")
Task How More
Arrange controls in rows, columns and grids that adapt to the window Select them, right-click → Group in a row / column / grid, or use a container from the toolbox Layouts
Keep a control glued to an edge when the window grows Position → Anchors in Properties Properties
Change colors, fonts, borders and shadows Style in Properties; the whole window in the form’s Style Styles and themes
Animate on hover or click, add glow, blur or glass Effects and Motion in Properties Animations and effects
Fill fields from data and validate them Data section: binding and rules Data binding
See the form in another theme, language or OS frame View → Preview theme / language / window frame Interface
Reuse a group of controls in many forms Turn it into a component Component view
Paint a background with a GPU effect The Shader control in Display, with a .pzshad Shading

A form is JSON: its size and look, and every control with its type, position and properties. Its handlers live next to it in a Python module with the same name. Both are yours to version, review and edit by hand.

hello.pzform (abridged)
{
"format": "pyzed.form/1",
"form": {"name": "hello", "title": "Greeter", "width": 360, "height": 220, "theme": "One Dark"},
"controls": [
{"name": "your_name", "type": "input", "x": 24, "y": 24, "width": 312, "height": 32,
"props": {"placeholder": "Your name"}, "events": {}},
{"name": "greet", "type": "button", "x": 24, "y": 72, "width": 120, "height": 32,
"props": {"text": "Say hello"}, "events": {"click": "greet_click"}}
]
}