Qt Designer helps you build a GUI (graphical user interface). You can load a GUI from Python. In this tutorial we’ll show you step by step.
It covers a very basic example of how to use Qt Designer with PyQt and Python. For more details see the link below.
Download PyQt examples
To start with this tutorial you need these installed:
- Qt Designer
You will need Python 3 or above, because the others are out dated.
If you don’t have PyQt, install PyQt.
You can install Designer (Ubuntu Linux) with:
sudo apt-get install qttools5-dev-tools
On other platforms it’s included in the setup.
Start designer by typing
designer in the command line. Important: qt creator is another program.
On Ubuntu Linux:
A popup shows up. You can choose what you want to design.
Choose “Main Window” and click create.
You can then resize the form and drag and drop widgets. It’s pretty simple to design a graphical interface like this.
If you click on a widget (say a button), you can set its properties like name.
You can export your design to a UI file. Click File > Save As > yourname.ui
Then you can convert the ui code to a python file.
pyuic5 /home/linux/helloworld.ui -o helloworld.py
The Python file then contains the gui definition.
Create another file that loads the ui file:
from PyQt5 import QtCore, QtGui, QtWidgets
Once you run it your GUI appears.