All Projects → twisted → qt5reactor

twisted / qt5reactor

Licence: other
Twisted and PyQt5 eventloop integration. Borrowed from https://github.com/nehbit/aether-public/blob/master/qt5reactor.py

Programming Languages

python
139335 projects - #7 most used programming language

Qt5Reactor

PyPI version supported Python versions source on GitHub GitHub Actions build status

Using the Qt5Reactor

Qt5Reactor is compatible with both PyQt5 and PySide2.

Install using pip

pip install qt5reactor

Before running / importing any other Twisted code, invoke:

app = QApplication(sys.argv) # your code to init QtCore
from twisted.application import reactors
reactors.installReactor('qt5')

or

app = QApplication(sys.argv) # your code to init QtCore
import qt5reactor
qt5reactor.install()

Testing

trial --reactor=qt5 [twisted] [twisted.test] [twisted.test.test_internet]

Make sure the plugin directory is in path or in the current directory for reactor discovery to work.

There is also pytest-twisted for use with pytest. You can specify to use the qt5reactor by adding --reactor=qt5reactor.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].