Thank you very much for your explanation! Now I&#39;ve understood what&#39;s the problem in iterate().<br><br>On these lines I&#39;ve prepared a this little test case (in attach):<br><br>Test 1<br><br>$ python runner.py<br>
click on the button<br>minimize/unminimize window to force a widget redraw, the window should be blank.<br>you can click another time on the button, the event is catched but no &quot;button animation&quot; is performed<br>
<br>Test2<br><br>$ python runner.py<br>open another console<br>$ python runner_other_process.py<br>click on the button of runner_other_process, this connects itself to the server in the first process<br>each window should redraw correctly<br>
<br><div class="gmail_quote">2010/5/24 Glyph Lefkowitz <span dir="ltr">&lt;<a href="mailto:glyph@twistedmatrix.com">glyph@twistedmatrix.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im"><br>
On May 23, 2010, at 6:36 PM, Gabriele Lanaro wrote:<br>
<br>
&gt; In which sense it&#39;s invalid? I don&#39;t know how the gtk reactor works, I just guessed that the event loop never reaches the gui events. My idea was to force the processing of these events before spawning another deferred, it&#39;s just a workaround, the real problem is  the fact that the server and the client resides in  the same loop (for testing).<br>

<br>
</div>It&#39;s invalid to run reactor.iterate() inside the reactor mainloop.  You can&#39;t force event-processing order in Twisted; if you want an event to not get processed, you need to delay its event source from getting invoked (producer.pauseProducing(), transport.stopReading(), transport.stopWriting(), Deferred.pause() are all ways to do this).<br>

<br>
It&#39;s invalid to use reactor.iterate() in this way because the reactor may invoke you reentrantly and there&#39;s no sane way to handle that.<br>
<br>
For example, your code is running because select() said your file descriptor was ready for reading, which then invoked dataReceived, which then invoked your method with buffered data, which then called iterate(), which then called dataReceived, which then called your method with buffered data, which then called iterate(), which then ...<br>

(and so on, forever, unless your application code conflicts with itself and running and starts blowing up and throwing incomprehensible tracebacks everywhere because of &quot;impossible&quot; recursion.<br>
<div class="im"><br>
&gt; Which can be the reason of the mainloop &quot;block&quot;?<br>
<br>
</div>Lots of reasons.  The example you gave wasn&#39;t syntactically valid Python, so it&#39;s hard to say.  Consider sending along an &lt;<a href="http://sscce.org/" target="_blank">http://sscce.org/</a>&gt; and maybe we can tell you more :).<br>

<div><div></div><div class="h5"><br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</div></div></blockquote></div><br>