简体   繁体   中英

How to click the same button on Tkinter python once the process completed with threading

I have simple program with only one function which process files and then converts to pdf on a press of button. initially GUI window freezes while the function was running, after this I introduced threading into the program and now GUI freezing issue was resolved, but now when press the button again it shows below error

在此处输入图像描述

if anyone can help me on how to fix this and also explain how it works, that will be really helpful, as I am new to python and just started using Tkinter .

sample code would be even more helpful.

You shouldn't use the old thread object you used on the first button click. Instantiate a new one instead.

This is because, you can't start the same thread twice.

So maybe keep a list of threads and add a new one with each button click.

i have found the solution for my problem

TkInter disable buttons while thread is running by furas

Thank you all

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM