Python GUI — Building a Simple Application with PyQt and Qt Designer
This article is intended for those who are just starting their acquaintance with creating graphical user interface (GUI) applications in Python. In it, we’ll cover the basics of using PyQt in conjunction with Qt Designer. Step by step, we will create a simple Python GUI application that will display the contents of the selected directory.
What do we need?
We need PyQt and Qt Designer, and Python, of course.
This article uses PyQt5 with Python 3, but there are no major differences between PyQt and PySide or their Python 2 versions.
Windows: PyQt can be downloaded here. It comes with Qt Designer.
macOS: You can install PyQt using Homebrew:
$ brew install pyqt5
You can download the package with most of the Qt components and tools, which contains Qt Designer, at this link.
Linux: Everything you need is probably in your distribution’s repositories. Qt Designer can be installed from the Application Center, but PyQt has to be installed through the terminal. Install everything that we need with one command, for example, like this:
# For Fedora:
$ sudo dnf install python3-qt5 qt-creator
# For Debian/Ubuntu:
$ sudo apt…