I want to create threads in PyQt4 fornormaluseGUI.
Make thread class:
class solveThreadQtCore.QThread:
def runself:
<what do you want doing>
Check for use thread with same name and kill it if yes:
if hasattr(self,′s1′):
delself.s1
self.s1=solveThread
If I want terminate thread by button, I use variable self.isExit=0 in infinite while loop Idon′tuseThread.terminate( ). And I use refresh GUI each 5-10 sec (otherwise my GIU is freezing).
Make thread class:
class solveThreadQtCore.QThread:
def runself:
<what do you want doing>
Check for use thread with same name and kill it if yes:
if hasattr(self,′s1′):
delself.s1
self.s1=solveThread
If I want terminate thread by button, I use variable self.isExit=0 in infinite while loop Idon′tuseThread.terminate( ). And I use refresh GUI each 5-10 sec (otherwise my GIU is freezing).
Комментариев нет:
Отправить комментарий