The purpose of the article is to show the installation process of PyQt5 on Windows and to show how to create GUI with the help of PyQt5.
PyQt is a GUI widget-toolkit in python. Qt functions as a cross-platform application development framework. It is a Python interface for Qt, one of the most powerful and popular cross-platform GUI library.PyQt are availables in PyQt4 and PyQt5 editions. We are discussing PyQt5 in this article, for this we need python 3.5 version or above and hardware architecture (32 bit or 64 bit)
There are many ways to install PyQt in windows OS
1. Installation with wheels
Wheels can be installed using pip (Python's package manager), which is included by default in the Python 3.5 or above. If you have older python version then you must install pip.
2. Building and installation from Source
Second option is to build from source. This can be a bit complicated.
3. Using package managers
Third option is to use package managers on Linux distributions and macOS. For Windows, you can use a binary
4. Using Anaconda
Anaconda provides a user-friendly installation wizard that you can use to install PyQt on your system. Anaconda installation will occupy a large amount of disk space. So if you install Anaconda only to use the PyQt packages, then you’ll have a serious amount of unused packages and libraries on your system.
Here i will describes the installation with wheels
To Install PyQt5
i. open command prompt
ii.Type the following in command prompt.
pip install pyqt5
iii. Install tools available in PyQt5
pip install pyqt5-tools
iv.Now import PyQt5 in python shell
v.Now import site and print the result of getsitepackages(). It shows the location of the python executable and site-packages folder.
And the located address gives the PyQt5 tools folder.This folder contains many files, one file name with designer.exe. This is the program that we will use to make designing GUIs a lot easier.
vi.Run the designer.exe program and you will be welcomed with a selection window.Select main window and then click create.
Now you have the widgets in left sides.so, by drag and drop you are able to make objects or elements of the interface.
Installation process is completed
Creating PyQt Application
Now you’re ready to start coding. You’re going to create an application with Python and PyQt. Here are the steps you’ll follow: