Project description
Installation
Wheels for the GPL version for 32 Windows can be installed from PyPI:
pip install PyQt5Designer
Binary
site-packages/QtDesigner/designer.exe
site-packages/QtDesigner/linguist.exe
site-packages/QtDesigner/qml.exe
Scripts
If Python.xxScripts in your PATH environment, you can run it directly, like: designer.exe, linguist.exe, qmlview.exe
Download files
Download the file for your platform. If you’re not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Qt Designer Download
Install Qt Designer on Windows or Mac.
Tiny download: Only 40MB!
Many people want to use Qt Designer without having to
download gigabytes of other software. Here are small,
standalone installers of Qt Designer for Windows and Mac:
What is Qt Designer?
Qt Designer is a tool for quickly building graphical user
interfaces with widgets from the
Qt GUI framework. It gives you a
simple drag-and-drop interface for laying out components
such as buttons, text fields, combo boxes and more. Here is
a screenshot of Qt Designer on Windows:
Qt Designer produces .ui
files. This is a
special XML-based format that stores your widgets as a tree.
You can either load these files at runtime, or have them
translated to a programming language such as C++ or Python.
Qt Designer and Python
Many people like to use Qt Designer together with Python
because it is a very productive programming language. The
easiest way to combine the two is via
PyQt or PySide6.
To install PyQt, simply enter the following on the command
line:
python3 -m venv venv source venv/bin/activate # or "call venv\Scripts\activate.bat" on Windows python3 -m pip install PyQt6
(This assumes you have Python 3 installed.)
Suppose you have saved your file from Qt Designer as
dialog.ui
. Then you can create another file,
say main.py
, with the following contents:
from PyQt6 import uic from PyQt6.QtWidgets import QApplication Form, Window = uic.loadUiType("dialog.ui") app = QApplication([]) window = Window() form = Form() form.setupUi(window) window.show() app.exec()
When you then invoke python main.py
on the command line, the GUI you created in Designer should
open:
How you can create an installer
Once you’ve created an application with Qt Designer, you
typically want to create an installer for it. On Windows,
this is often an installation wizard in the form of
an .exe:
On macOS, .dmg archives are commonly used:
We can use fbs to
create such installers for applications based on Qt and
Python. The free eddition of fbs supports Python 3.6 and
PyQt5. Later versions require
fbs Pro.
Once you’ve installed fbs, you can create an installer for
the Python application from above as follows:
Run the command fbs startproject
. This asks you
a few questions about the name of your app etc. It creates
the directory src/main/python
. The command
fbs run
should now give you a quick preview of
the empty application created by startproject
.
Change main.py
from before to the following:
from PyQt6 import uic from PyQt6.QtWidgets import QApplication from fbs_runtime.application_context.PyQt6 import ApplicationContext Form, Window = uic.loadUiType(appctxt.get_resource("dialog.ui")) appctxt = ApplicationContext() window = Window() form = Form() form.setupUi(window) window.show() appctxt.app.exec()
Save main.py
in src/main/python
,
overwriting the existing file there.
Create the directory src/main/resources/base
.
Move dialog.ui
from above into it. When you now
do fbs run
, then you should again see the GUI
you created in Designer.
Run the command fbs freeze
. This turns your
Python (and Designer) code into a standalone executable that
can be copied to other computers.
Then execute fbs installer
. On Windows, you
need to install NSIS first and place it on your
PATH
. On Linux, you need
fpm. But
once you have these prerequisites, fbs will magically create
your installer. Congratulations!
Where to learn more
If you want to learn more about combining Qt Designer with
Python, you may be interested in my
book:
It distills years of experience to quickly help you create
better GUI applications. I’m humbled to say that even Phil
Thompson, the creator of PyQt, read it and thinks it’s
«very good».
Qt Designer vs. Qt Creator
Qt Designer normally ships as a part of Qt Creator.
This is Qt’s official editor and lets you do a lot more than
just graphically design user interfaces. It is a
full-fledged and very powerful C++ IDE. This power comes at
a price however: The download for Qt Creator is gigabytes in
size!
This page was created for people who only need Qt Designer.
The download links here contain minimal, self-contained
installers of just Qt Designer that are orders of magnitude
smaller. Here they are again:
Michael has been working with Qt and Python since
2016, when he started
fman,
a cross-platform file manager. Frustrated with the
difficulties of creating a desktop app, Michael open
sourced
fman’s build system (fbs). It saves you
months when creating Python Qt GUIs. Recently,
Michael also wrote a popular
book
about these two technologies.
Search code, repositories, users, issues, pull requests…
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Sign up
Qt Designer is a cross-platform drag and drop GUI designer, which can be used to build UIs for both PyQt and PySide.
It is a great tool to simplify the process of building interfaces for your applications.
While Qt Designer is distributed by Qt as part of the Qt Creator integrated IDE, most of that IDE is not useful or helpful
for Python development — primarily being designed for C++ developers. If you just want the Designer application, this is
not currently available from Qt. But helpfully, other people have stepped up to make this available.
In this guide we’ll look at the various options available for installing Qt Designer as a standalone application on your system.
Since the Qt Designer software is free software, these alternative distributions of Qt Designer are permitted.
PyQt Command line launcher
Qt Designer is available on PyPi via the pyqt5-tools
package. This can be pip
installed just like any other Python package.
This wrapper will download and install Qt Designer for you and provide a command-line launcher to start the program.
- PyQt6
- PyQt5
bash
pip install pyqt6-tools
bash
pip install pyqt5-tools
After installation you can run Qt Designer from the command line using the built-in launcher.
- PyQt6
- PyQt5
If this doesn’t work check your Python scripts
folder is in your PATH
.
PySide6 Command line launcher
In recent versions of PySide6 Qt Designer is installed automatically when you install PySide6 with pip
. After installation you can
run Qt Designer from the command line using the built-in launcher.
If this doesn’t work check your Python scripts
folder is in your PATH
.
Over 10,000 developers have bought Create GUI Applications with Python & Qt!
[[ discount.discount_pc ]]% OFF for
the next [[ discount.duration ]]
[[discount.description ]]
with the code [[ discount.coupon_code ]]
Purchasing Power Parity
Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses
with code [[ discount.coupon_code ]]
Installing from Qt Package
If the above installation options don’t work for you, you can instead follow the following instructions to install
Qt Creator or Qt Designer depending on your platform.
If you install Qt Creator you can access Qt Designer through it, even if you don’t use any of the other functionality.
Windows
Qt Designer is available in the installation packages for Qt available from the Qt downloads page. Download and run the appropriate installer for your system and follow the platform-specific instructions below. Installing Qt Designer will not affect your Python PyQt5/6 or PySide2/6 installation.
Qt Designer is not mentioned in the Windows Qt installer, but is automatically installed when you install any version of the Qt core libraries. For example, in the following screenshot we’ve opted to install the MSVC 2017 64-bit version of Qt — what you choose will have no effect on your Designer install.
Installing Qt, will also install Qt Designer.
If you want to install Qt Creator it is listed under «Developer and Designer Tools». Rather confusingly, Qt Designer isn’t in here.
Installing the Qt Creator component.
macOS
Qt Designer is available in the installation packages for Qt available from the Qt downloads page. Download and run the appropriate installer for your system and follow the platform-specific instructions below. Installing Qt Designer will not affect your Python PyQt5/6 or PySide2/6 installation.
Qt Designer is not mentioned in the macOS Qt installer, but is automatically installed when you install any version of the Qt core libraries. Download the installer from the Qt website — you can opt for the open source version.
Inside the downloaded .dmg
file you’ll find the installer.
Open the installer to start the installation. Go through to where it asks you to choose which components to install. Select the macOS package under the latest version of Qt.
You only need the macOS package under the latest version.
Once the installation is complete, open the folder where you installed Qt. The launcher for Designer is under <version>/clang_64/bin
. You’ll notice that Qt Creator is also installed in the root of the Qt installation folder.
You can find the Designer launcher under the /clang_64/bin folder.
You can run Designer from where it is located, or move it into your Applications folder so it is available to launch from the macOS Launchpad.
Linux (Ubuntu & Debian)
You can install Qt Designer using your package manager. Depending on your distribution and version you will have either
Qt5 Designer or Qt6 Designer available..
- Qt5
- Qt6
bash
sudo apt-get install qttools5-dev-tools
bash
sudo apt-get install designer-qt6
Once installed, Qt Designer will be available in the launcher.
Qt Designer in Ubuntu launcher.
pyqt-tools
The PyQt6 wheels do not provide tools such as Qt Designer that were included in
the old binary installers. This package aims to provide those in a separate
package which is useful for developers while the official PyQt6 wheels stay
focused on fulfilling the dependencies of PyQt6 applications.
Both Windows and Linux are supported. Adjust paths etc accordingly if applying
the explanations below in Linux rather than Windows. macOS support is
incomplete but see issue #12 if you want to discuss it.
Installation
yourenv/Scripts/pip.exe install pyqt6-tools~=6.4
You will generally install pyqt6-tools using pip install
. In most cases
you should be using virtualenv or venv to create isolated environments to
install your dependencies in. The above command assumes an env in the
directory yourenv
. The ~=6.4
specifies a release compatible with
6.4 which will be the latest version of pyqt6-tools built for PyQt6 6.4. If
you are using a different PyQt6 version, specify it instead of 6.4. PyPI
keeps a list of all available versions.
- Note:
- As of pyqt6-tools v3 the package has been broken down into four pieces.
The wrappers remain here but the plugins are located in pyqt6-plugins,
some Qt application helpers in qt6-tools, and the applications are in
qt6-applications.
Usage
A program is provided available as Scripts/pyqt6-tools.exe
. There are
subcommands provided for each of Designer, QML Scene, and the QML Test Runner.
These wrapper commands provide additional functionality related to launching
the underlying programs. A larger set of Qt application are available as
subcommands of the Scripts/qt6-tools.exe
program. In both cases, passing
--help
will list the available subcommands.
Additionally, each pyqt6-tools
subcommand listed below includes a parameter
to run a basic example which can be used to see if the plugins are working.
These examples are not intended to be used as examples of good code.
Each subcommand searches up the filesystem tree from your current
working directory to find a .env
file and loads it if found. If found, the
environment variable DOT_ENV_DIRECTORY
will be set to the directory
containing the .env
file. With this extra variable you can specify paths
relative to the .env
location.
PYQTDESIGNERPATH=${PYQTDESIGNERPATH};${DOT_ENV_DIRECTORY}/path/to/my/widgets
Designer
There is a Scripts/pyqt6-tools.exe designer.exe
entry point that will help fill out
PYQTDESIGNERPATH
from either command line arguments or a .env
file.
Unknown arguments are passed through to the original Qt Designer program.
Usage: pyqt6-tools designer [OPTIONS] Options: -p, --widget-path DIRECTORY Paths to be combined with PYQTDESIGNERPATH --example-widget-path Include the path for the pyqt6-tools example button (c:\users\sda\testenv\lib\site- packages\pyqt6_plugins) --designer-help Pass through to get Designer's --help --test-exception-dialog Raise an exception to check the exception dialog functionality. --qt-debug-plugins / --no-qt-debug-plugins Set QT_DEBUG_PLUGINS=1 --help Show this message and exit.
If you want to view the generated code from within Designer, you can
run Scripts/pyqt6-tools.exe installuic
and it will copy pyuic6.exe
such that Designer will use it and show you generated Python code. Note that
this will enable viewing using the C++ menu item while the Python menu item
will be broken. Without having made this adjustment, the C++ option shows
C++ code while the Python option shows PySide2 code. pyqt6
must already
be installed or this script will be unable to find the original pyuic6.exe
to copy.
In addition to the standard features of the official Designer plugin, this
provides an exception dialog for your widget’s Python code. Otherwise Designer
in Windows silently crashes on Python exceptions.
QML Plugin
The QML plugin is also included. In the future a tool may be provided to
handle copying of the plugin to each directory where it is needed. For now
this must be done manually.
site-packages/pyqt6_tools/Qt/bin/plugins/pyqt6qmlplugin.dll
QML Scene
Usage: pyqt6-tools qmlscene [OPTIONS] Options: -p, --qml2-import-path DIRECTORY Paths to be combined with QML2_IMPORT_PATH --qmlscene-help Pass through to get QML scene's --help --qt-debug-plugins / --no-qt-debug-plugins Set QT_DEBUG_PLUGINS=1 --run-qml-example Run the pyqt6-tools QML example --help Show this message and exit.
QML Test Runner
Usage: pyqt6-tools qmltestrunner [OPTIONS] Options: -p, --qml2-import-path DIRECTORY Paths to be combined with QML2_IMPORT_PATH --qmltestrunner-help Pass through to get QML test runner's --help --qt-debug-plugins / --no-qt-debug-plugins Set QT_DEBUG_PLUGINS=1 --test-qml-example Test the pyqt6-tools QML example --help Show this message and exit.
Special Thanks
Thanks to MacStadium for providing me with a macOS system to develop and test
out the final pyqt6-tools platform. This is still ‘in work’. See
issue #12.