Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Hi i'm using the object QThread from pyqt From what i understood, your thread when he is running can only use his own variable and proc, he cannot change your main object variables So before you run it be sur to define all the qthread variables you will need</p> <p>like this for example:</p> <pre><code>class worker(QThread) def define(self, phase): print 'define' self.phase=phase self.start()#will run your thread def continueJob(self): self.start() def run(self): self.launchProgramme(self.phase) self.phase+=1 def launchProgramme(self): print self.phase </code></pre> <p>i'm not well aware of how work the basic python thread but in pyqt your thread launch a signal to your main object like this:</p> <pre><code>class mainObject(QtGui.QMainWindow) def __init__(self): super(mcMayaClient).__init__() self.numberProgramme=4 self.thread = Worker() #create self.connect(self.thread , QtCore.SIGNAL("finished()"), self.threadStoped) self.connect(self.thread , QtCore.SIGNAL("terminated()"), self.threadStopped) </code></pre> <p>connected like this, when the thread.run stop, it will launch your threadStopped proc in your main object where u can get the value of your thread Variables</p> <pre><code>def threadStopped(self): value=self.worker.phase if value&lt;self.numberProgramme: self.worker.continueJob() </code></pre> <p>after that you just have to lauch another thread or not depending of the value you get This is for pyqt threading of course, in python basic thread, the way to execute the def threadStopped could be different.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload