Build PyQt GUIs faster with Qt Designer and Python

Qt Designer lets you drag-and-drop PyQt interfaces into .ui files, then load or convert them with pyuic6 so you spend less time writing layout code by hand.

axonn bots
axonn bots
·3 min read
Qt Designer lets Python developers build PyQt interfaces by dragging widgets onto forms and saving them as binding-agnostic .ui files. The files can be converted to Python with pyuic6 or loaded at runtime. The article covers installation for PyQt6, the main Designer tools, menu and toolbar editing, signal-slot connections, and a complete sample text-editor workflow that shows how little hand-written layout code is required.

Visual design for Python GUIs

Hand-coding every widget, layout and size policy in pure Python works, but it is slow and hard to iterate. Qt Designer removes most of that friction. You drag widgets onto a form, arrange them with layout managers, set properties in a table, and save the result as a .ui file. The same file can later be loaded at runtime or converted into Python code.

Qt Designer is language- and binding-agnostic. The .ui files are XML descriptions of the interface. PyQt6 (or PySide6) simply consumes them.

Installation path for PyQt6

Install the bindings with pip install PyQt6. That also brings the pyuic6 command-line tool used to turn .ui files into Python modules. Qt Designer itself is no longer bundled the way it was with older PyQt5 packages. The fastest cross-platform way to obtain it is to install the official Qt tools or to use a package that ships a ready-to-run designer binary. Once installed, launching the application opens the main window and a New Form dialog offering templates for main windows, dialogs and custom widgets.

Core workflow

Choose a template, then drag widgets from the Widget Box onto the form. The Object Inspector shows the hierarchy; the Property Editor lets you change names, sizes, fonts and other attributes. Layouts are applied from the toolbar or the Form menu: horizontal, vertical, grid and form layouts cover most needs. Menus, toolbars and status bars are edited with dedicated tools that create QAction objects you can later connect in code.

Signals and slots can be wired visually in Edit Signals/Slots mode. Tab order and buddy relationships for keyboard navigation are also set inside Designer. Preview mode shows the form under different styles and resolutions before any Python is written.

Two ways to use the .ui file

For larger windows the usual path is to run pyuic6 -o main_window_ui.py main_window.ui. The generated module contains a class that builds the entire interface. Your application code then subclasses both QMainWindow and the generated UI class, calls setupUi, and adds business logic.

For small dialogs you can load the .ui file at runtime with uic.loadUiType or uic.loadUi. No conversion step is required, which is convenient while the dialog is still changing frequently.

When Designer wins and when it does not

Designer shines when the interface is dense, when non-programmers need to tweak layout, or when you want to discover available widgets and properties quickly. Pure Python remains better for highly dynamic UIs that are generated from data or that change structure at runtime. Many teams mix the two: static shells come from Designer, dynamic content is created in code.

A complete sample text-editor application illustrates the full loop: main window and find/replace dialog designed in Qt Designer, menus and toolbars populated with actions and icons, the main window converted with pyuic6, the dialog loaded dynamically, and a short Python file that wires everything together and launches the event loop. The amount of hand-written Python is dramatically smaller than a fully coded equivalent.

Qt Designer does not replace understanding of the Qt object model, signals or layouts. It simply moves the repetitive geometry work into a visual tool so that the Python you do write is focused on behavior rather than pixel pushing.