How to keep track of thread progress in Python without freezing the PyQt GUI?

后端 未结 5 1222
余生分开走
余生分开走 2020-12-12 20:07

Questions:

  1. What is the best practice for keeping track of a tread\'s progress without locking the GUI (\"Not Responding\")?
  2. Gene
5条回答
  •  醉梦人生
    2020-12-12 20:22

    If your method "processDoc" doesn't change any other data (just looks for some data and return it and don't change variables or properties of parent class) you may use Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS macroses ( see here for details ) in it. So the document will be processed in thread which will not lock the interpreter and UI will be updated.

提交回复
热议问题