I have a program with a tkinter GUI (Python 2.7) from which the user can launch some more or less calculation-intense tasks. Most of those result either in a file written to disk or an interactive pyplot window showing results, but none of them feed back into the main task.
I've never done multithreading before and am trying to decide which library to go for. subprocess
seems to be for system calls (which this is not), multiprocessing
seems to be concerned with parallel execution of larger tasks (with pools and queues and such), and threading
... I've looked through the official documentation but am somewhat unclear how I would use this.
The ideal solution for me would be something that would "simply" phrase the function call which triggers calculating and plotting some data in a way that it will be executed independent of the main program so the user can keep doing their thing without waiting for the function to finish (which usually takes a few seconds up to a minute) -- the plot would just eventually pop up.
Update Turns out the task I wanted to launch in parallel contains bound methods, thus is not picklable and can't be used in parallel. I need to deal with some other business before I'll have time to figure out how to change that -- I'll get back to this, though!