Popular recipes tagged "intensive"http://code.activestate.com/recipes/tags/intensive/2017-02-06T18:30:18-08:00ActiveState Code RecipesLong processing computation in Tkinter or long-running task (Python)
2017-02-06T18:30:18-08:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580754-long-processing-computation-in-tkinter-or-long-run/
<p style="color: grey">
Python
recipe 580754
by <a href="/recipes/users/4189907/">Miguel Martínez López</a>
(<a href="/recipes/tags/computation/">computation</a>, <a href="/recipes/tags/intensive/">intensive</a>, <a href="/recipes/tags/long/">long</a>, <a href="/recipes/tags/task/">task</a>, <a href="/recipes/tags/tkinter/">tkinter</a>).
Revision 12.
</p>
<p>I provide in this module the function "tk_call_async": It executes a function asynchronously.</p>
<pre class="prettyprint"><code>tk_call_async(window, computation, args=(), kwargs={}, callback=None, polling=100, method=MULTIPROCESSING)
</code></pre>
<p>"tk_call_async" executes the function "computation" asynchronously with the provided "args" and "kwargs" without blocking the tkinter event loop.</p>
<p>If "callback" is provided, it will be called with the result when the computation is finished.</p>
<p>If an exception happens doing the computation, the errback function is called with the exception if this is provided.</p>
<p>"Polling" will be the frequency to poll to check for results.</p>
<p>There is two methods to execute the task: using multiprocessing or using threads.</p>