How to install PyQt5 and Qt Designer on Ubuntu



PyQt is the binding of Qt for Python. It allows us to use the graphic framework Qt to create Graphic User Interfaces for our Python programs.
Qt is not only a very complete library for GUI development, one of its advantages over other GUI libraries for Python like Tkinter, is its graphic designer: Qt Designer, that we can use to draw graphic interfaces for our programs by dragging and dropping widgets in a window with no need to code, simplifying the process of designing the GUI.

Installing Qt and Qt Designer

To get Qt Creator and Qt Designer in your system you need to type the following commands in the terminal:
sudo apt install build-essential

sudo apt install qtcreator

sudo apt install qt5-default

The build-essential includes all the tools needed to create packages for Debian and Ubuntu, while qtcreator will install Qt Creator, the IDE used to build Qt Apps. qt5-default will allow us to use Qt5 as the default version of Qt in Qt Creator.

Installing PyQt5

To install PyQt5 in Ubuntu, you'll need to run the following command on a terminal:
python3 -m pip install pyqt5

That way you'll install PyQt5 using PIP for Python 3.

Running Qt Designer

Now you'll find Qt Designer in your applications menu, after opening it, you'll the next window will appear:


There you can select a template to start drawing your interface. For this example, I'll select Main Window


To run the program, press Ctrl+R and that's all:


In the next series of posts, I'll show you the basic use of Qt Designer and how to create a GUI for your Python programs using Qt5.

Comments

Popular posts from this blog

How to install Spyder 3 on Windows without Anaconda

Hello World in Python 3