user3599280 user3599280 - 11 months ago 79
Python Question

tkinter populate treeview using threading pool

I'm looking for "best" way to populate treeview using threads.
I have multiple mail account which I'm checking for new emails.

My plan is to use

to store accounts which will be checked
method. This method will return a list of new

Can I use another
which I will populate with new mails and
somehow loop while threads are alive?

Is there any thread-safe, good pattern to solve this?


Your question is very broad, so this answer will also be.

Generally speaking, tkinter doesn't play well with multi-threading. You can do it, but must make sure only the main thread interacts with the GUI. A common way to do this is to use the universal widget method after() to schedule handling of data going out to or being retrieved from background threads, typically via Queues, at regular intervals.