Tuesday, December 31, 2019

Installing PyQt


Python : What is PyQt

PyQt is a python binding of the open-source widget-toolkit Qt, which also functions as a cross-platform application development framework. Qt is a popular C++ framework for writing GUI applications for all major desktop, mobile, and embedded platforms (supports Linux, Windows, MacOS, Android, iOS, Raspberry Pi, and more).

PyQt is developed and maintained by Riverbank Computing, a company based in England, whereas Qt is developed by a Finnish firm called The Qt Company.

Features:
PyQt consists of more than six hundred classes covering a range of features such as

Graphical User Interfaces
SQL Databases
Web toolkits
XML processing
Networking


PyQt Versions
PyQt is available in two editions, PyQt4 and PyQt5. PyQt4 provides glue code for binding 4.x and 5.x versions of the Qt framework while PyQt5 provides a binding for only the 5.x versions. As a result, PyQt5 is not backward compatible with the deprecated modules of the older version.

Riverbank Computing also provides PyQt3D—the python bindings for the Qt3D framework. Qt3D is an application framework used to create real-time simulation systems with 2D/3D rendering.



Using Wheel files
Building and Installing from Source

Installing using Wheels

Wheels are the new standard Python packaging and distribution format. Simply speaking, a wheel is a ZIP archive with a special name and .whl file extension. Wheels can be installed using pip (Python's package manager), which is included by default in the recent versions of Python.

pip install PyQt5

Trying to install the PyQtT5, it gave below error
ERROR: Could not find a version that satisfies the requirement PyQt5 (from versions: none)
ERROR: No matching distribution found for PyQt5

OK, instead of this, running the below installed Qt5

pip3 install PyQt5

This installed PyQt5 but when trying to run the app, it still says could not be found

Below is the code for demonstrating Qt capabilities

import sys
print(sys)
from PyQt5.QtWidgets import QApplication, QWidget
if __name__ == "__main__":
    app = QApplication(sys.argv)
    w = QWidget()
    w.resize(300,300)
    w.setWindowTitle('Cisco')
    w.show()
    sys.exit(app.exec_())


References:
https://www.guru99.com/pyqt-tutorial.html#1

No comments:

Post a Comment