February 2019
Intermediate to advanced
450 pages
9h 59m
English
To use a thread in Qt, we can use the QThread class from QtCore. Hopefully, you can see a pattern here. QtCore has many functionalities beyond creating widgets. Threading is important because when building a decentralized application we will have to wait for quite some time for the transaction to be confirmed. Depending on how generous you are with the gas and the traffic in Ethereum, the wait could be anything from a few minutes to half an hour. We don't want the GUI application to freeze for a minute, let alone half an hour.
Let's create a simple script to demonstrate how we create a thread using QThread. Name the script hello_thread.py:
from PySide2 import QtCoreimport timeclass SimpleThread(QtCore.QThread): def __init__(self, ...
Read now
Unlock full access