PyQt5 Quick Start (a) Introduction PyQt5

PyQt5 Quick Start (a) Introduction PyQt5

A, PyQt5 Profile

1, PyQt5 Profile

PyQt Python language is Qt framework implementation, developed by the Riverbank Computing, one of the most powerful GUI library. PyQt provides a well-designed set of window controls, each control corresponds to a PyQt Qt controls, so the API interface and Qt PyQt API interface is very close, but no longer use PyQt QMake system and Q_OBJECT macros.
Official Website: www.riverbankcomputing.com
PyQt5 provide GPL version and commercial version of the certificate, developers can freely use the free GPL license, if PyQt needs to be used in commercial applications, you must purchase a commercial license.

2, PyQt5 features

PyQt5 characteristics are as follows:
(1) High Performance Qt set of GUI controls.
(2) cross-platform running on Linux, Window and Mac OS systems.
(3) using the signal slots mechanism for communication.
(4) fully encapsulated in Qt library.
(5) can be performed using established IDE interface design, and automatically generate executable Python code.
(6) provides a complete set of full range of window controls.

3, the difference PyQt4 and PyQt5

PyQt5 PyQt4 differs as follows:
(1) re-combining module, PyQt5 some module has been discarded (QtScript), some split into two sub-modules (QtGui, QtWebKit).
(2) adding new modules, such as QtBluetooth, QtPositioning and Enginio.
(3) waste SINGAL () and SLOT (), using the new channel signal processing mode.
(4) no longer support all discarded or marked as deprecated Qt API.

Two, PyQt5 module

PyQt5 Python is a series of modules, there are more than 620 categories, 6000 functions and methods, the following main modules:
(. 1) non-GUI features include the QtCore core. The main and time, file, file
folders, various data streams, URLs, mime class files, processes, threads used together.
(2) QtGui include window systems, event processing, 2D images, basic drawing, font and text classes. QtWidgets class contains a series of desktop applications to create UI elements.
(3) QtMultimedia comprising processing multimedia call and the camera API class.
(4) QtBluetooth module contains classes to find and Bluetooth connection.
(5) QtNetwork class containing network programming, allows TCP / IP and UDP develop more convenient and reliable.
(6) QtPositioning comprising positioning classes, the satellite may be used, WiFi or even text.
(7) Engine include a client by entering Qt Cloud and management classes.
(8) QtWebSockets class comprising WebSocket protocol.
(9) QtWebKit WebKit2 group comprising a web browser.
(10) QtWebKitWidgets based QtWidgets comprising the WebKit1 class.
(11) QtXml comprising xml handling, there is provided a tool SAX and DOM API.
(12) QtSvg providing a display based SVG content, Scalable Vector Graphics (SVG) is based on an extensible markup language (XML), for describing two-dimensional vector graphics format graphics.
(13) QtSql database processing tools.
(14) QtTest provides tools to test PyQt5 applications.

Three, PyQt5 examples

import sys
import os
from PyQt5 import QtWidgets, QtCore

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    widget = QtWidgets.QWidget()
    widget.resize(800, 600)
    widget.setWindowTitle("Hello, PyQt5")
    widget.show()

    sys.exit(app.exec_())

Guess you like

Origin blog.51cto.com/9291927/2422184