There is a program for pyqt5. It has a thread (qthread) in which you need to perform some action with a certain front end. I used QThread.msleep to define this period, and the flag that came out of the while cycle. But if the period is long, then it will take a long time to wait for the exit from the loop, and I want to finish it as soon as I click on the button in the GUI (but not kill, start again soon). The source code is pretty standard here, I need ideas.
An example of an exaggerated class for a separate thread.
class intrhead(QObject):
...
def run(self):
while(flag):
...
QThread.msleep(period)
The correct solution is to split the period.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.