M
M
Max Payne2016-06-02 21:49:26
Python
Max Payne, 2016-06-02 21:49:26

Multithreading in python gui?

I have a window in gui tkinter. On it, relatively speaking, there is a button and a text field. The button has the following function:

def buttonreg(event):
    pool = ThreadPool(20)
    pool.map(nf, list)
    pool.close()
    pool.join()

In the nf function, the output to the text field is as follows:
log_txt.insert('1.0', 'textX')
However, you have to wait until the pool is completed for all the elements in the list list, and only then the result is displayed in the text field. How can I make the result appear immediately?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max Payne, 2016-06-03
@YardalGedal

Decision:
pool.map_async(nf, list)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question