pyqode.qt package

Submodules

QtCore module

Provides QtCore classes and functions.

QtDesigner module

Provides QtDesigner classes and functions.

QtGui module

Provides QtGui classes and functions.

Warning

All PyQt4/PySide gui classes are exposed but when you use PyQt5, those classes are not available. Therefore, you should treat/use this package as if it was PyQt5.QtGui module.

QtNetwork module

Provides QtNetwork classes and functions.

QtTest module

Provides QtTest and functions

Warning

PySide is not supported here, that’s why there is not unit tests running with PySide.

QtWidgets module

Provides widget classes and functions.

Warning

All PyQt4/PySide gui classes are exposed but when you use PyQt5, those classes are not available. Therefore, you should treat/use this package as if it was PyQt5.QtWidgets module.

Module contents

pyqode.qt is a shim over the various qt bindings. It is used to write qt bindings indenpendent library or application.

The shim will automatically select the first available API (PyQt5, PyQt4 and finally PySide).

You can force the use of one specific bindings (e.g. if your application is using one specific bindings and you need to use library that use pyqode.qt) by setting up the QT_API environment variable.

PyQt5

For pyqt5, you don’t have to set anything as it will be used automatically:

>>> from pyqode.qt import QtGui, QtWidgets, QtCore
>>> print(QtWidgets.QWidget)

PyQt4

Set the QT_API environment variable to ‘PyQt4’ (case insensitive) before importing any python package:

>>> import os
>>> os.environ['QT_API'] = 'PyQt4'
>>> from pyqode.qt import QtGui, QtWidgets, QtCore
>>> print(QtWidgets.QWidget)

Warning

This requires to set the SIP api to version 2 (for strings and covariants). If you’re using python2 you have to make sure the correct sip api is set before importing any PyQt4 module (pyqode.qt can take care of that for you but it must be imported before any PyQt4 module).

PySide

Set the QT_API environment variable to ‘PySide’ (case insensitive) before importing pyqode:

>>> import os
>>> os.environ['QT_API'] = 'PySide'
>>> from pyqode.qt import QtGui, QtWidgets, QtCore
>>> print(QtWidgets.QWidget)