<br><br><div class="gmail_quote">On Tue, Mar 17, 2009 at 11:53 AM, Phil Thompson <span dir="ltr">&lt;<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On Tue, 17 Mar 2009 11:32:48 -0500, Marc Nations &lt;<a href="mailto:mnations.lists@gmail.com">mnations.lists@gmail.com</a>&gt;<br>
wrote:<br>
<div><div></div><div class="h5">&gt; Hi,<br>
&gt; In the past with other gui toolkits I&#39;ve set up a periodic call function<br>
&gt; that pulls control back from the child threads and take care of all the<br>
gui<br>
&gt; business that gets originated in the child threads. Either I&#39;ve stored<br>
all<br>
&gt; the commands in a queue to be processed when periodic check is executed<br>
or<br>
&gt; used some other technique so that the gui runs the commands from within<br>
the<br>
&gt; gui thread and doesn&#39;t spit the bit by trying to perform the commands in<br>
&gt; another thread.<br>
&gt;<br>
&gt; Does Qt have a &quot;best accepted&quot; way of handling this? I&#39;ve read that some<br>
&gt; use<br>
&gt; connections to pass control between threads, but I wasn&#39;t sure if that&#39;s<br>
&gt; the<br>
&gt; most efficient way. I basically just need to output text updates to the<br>
&gt; status window, so I can either queue up the text to be displayed or the<br>
&gt; calls themselves to be executed later. However if Qt efficiently fires a<br>
&gt; signal when a certain event happens and fills the slot in the appropriate<br>
&gt; thread then that sounds like a better approach.<br>
<br>
</div></div>Qt only has one mechanism for communications between threads - events.<br>
Inter-thread connections are implemented using events.<br>
<br>
Use whatever results in the most readable and/or reusable code. Personally<br>
I&#39;d use signals and slots with the text as an argument, so that the code<br>
could be reused without threads without being changed.<br>
<font color="#888888"><br>
Phil<br>
</font></blockquote></div><br><div>So will using the threading functionality in Python, independent of the threading functionality in Qt, cause problems with the execution? </div><div><br></div><div>I created a worker thread using the standard Python threading module, so as a result I can&#39;t use it to emit a signal. I can create another class in that thread (basically a dummy class from <span class="Apple-style-span" style="font-family: -webkit-monospace; ">QtCore.QObject)<span class="Apple-style-span" style="font-family: arial; "> and use it to just be a signal emitter. That&#39;s the quickest fix. But if not using the threading functionality inherent in Qt will cause issues down the road, then I&#39;ll need to rewrite my thread class.</span></span></div>
<div><br></div><div>Thanks,</div><div>Marc</div><div><br></div>