0

I have Python/Tkinter Application that, at 2-3 points of time, locks the main screen for 30 seconds to several minutes, as it has a lot of stuff it needs to do.

I have it in my mind that during those points in time, it would be a more polished application if instead of locking the main screen for the duration of the task, I could separate the computationally intensive part of the application from the main thread, and display some sort feedback to the user as to what is happening...whether that is a modal status window, or a spinning cat animation.

I am unfortunately a little lost as to what's a clean way to do this.

Faydey
  • 725
  • 1
  • 5
  • 12

1 Answers1

0

You could look up concurrent.futures, multiprocessing, threading and using tkinter .after() method. I recently posted my question and answer on using concurrent.futures. I have successfully implemented the model described in Mark Summerfield's book and I recommend you give concurrent.futures a try. You still need 1 or 2 commands from threading and multiprocessing. My code worked well and there is no latency issue with tkinter. Note: This working code is more detailed than the example code in my answer, which I used to show that a python class could be used to host the concurrent.future codes instead of a separate python file. Hope you find something suitable for your coding needs.

Happen to see a recent answer that relates to answering your question. .after() with threading example. It has other links.

Community
  • 1
  • 1
Sun Bear
  • 7,594
  • 11
  • 56
  • 102