How to stop a QThread from the GUI

后端 未结 3 525
死守一世寂寞
死守一世寂寞 2020-12-14 23:43

This is a follow up question to a previous one I posted earlier. The problem is how to stop (terminate|quit|exit) a QThread from the GUI when using the recommended method

3条回答
  •  粉色の甜心
    2020-12-15 00:00

    You can stop the thread by calling exit() or quit() . In extreme cases, you may want to forcibly terminate() an executing thread. However, doing so is dangerous and discouraged. Please read the documentation for terminate() and setTerminationEnabled() for detailed information.

    src: https://doc.qt.io/qtforpython/PySide2/QtCore/QThread.html

提交回复
热议问题