I'm wondering how to call an external program in such a way that allows the user to continue to interact with my program's UI (built using tkinter, if it matters) while the Python program is running. The program waits for the user to select files to copy, so they should still be able to select and copy files while the external program is running. The external program is Adobe Flash Player.
Perhaps some of the difficulty is due to the fact that I have a threaded "worker" class? It updates the progress bar while it does the copying. I would like the progress bars to update even if the Flash Player is open.
I tried the
subprocessmodule. The program runs, however it prevents the user from using the UI until the Flash Player is closed. Also, the copying still seems to occur in the background, it's just that the progress bar does not update until the Flash Player is closed.def run_clip(): flash_filepath = "C:\\path\\to\\file.exe" # halts UI until flash player is closed... subprocess.call([flash_filepath])Next, I tried using the
concurrent.futuresmodule (I was using Python 3 anyway). Since I'm still usingsubprocessto call the application, it's not surprising that this code behaves exactly like the above example.def run_clip(): with futures.ProcessPoolExecutor() as executor: flash_filepath = "C:\\path\\to\\file.exe" executor.submit(subprocess.call(animate_filepath))
Does the problem lie in using subprocess? If so, is there a better way to call the external program? Thanks in advance.