擅长:python、mysql、java
<p>要完成德里斯对这一点的回答:</p>
<blockquote>
<p>Also consider that this allows your user to interact with the application, so make sure that any interactions that can happen either are not allowed, such as <code>somebutton.enabled(False)</code>, or are handled gracefully, like a <code>Cancel</code> button to stop a long task.</p>
</blockquote>
<p>您可能希望使用<a href="http://pyqt.sourceforge.net/Docs/PyQt4/qeventloop.html#ProcessEventsFlag-enum" rel="nofollow noreferrer">^{<cd1>}</a>标记:<code>QCoreApplication.processEvents(QEventLoop.ExcludeUserInputEvents)</code>来刷新GUI,同时防止用户激活任何小部件。你知道吗</p>
<blockquote>
<p><code>QEventLoop.ExcludeUserInputEvents</code> </p>
<p><code>0x01</code></p>
<p>Do not process user input events, such as <code>ButtonPress</code> and <code>KeyPress</code>. Note that the events are not discarded; they will be delivered the next time <code>processEvents()</code> is called without the <code>ExcludeUserInputEvents</code> flag.</p>
</blockquote>