简体   繁体   中英

Writing to text widget during runtime using Tkinter

I used Tkinter to create a simple UI for my python script. It's quite a long program and once the user clicks on a button, it takes at least 5 mins to finally create the output Excel sheet. In the meanwhile, I want to use the text widget to keep the user informed of the status. But when I use text.insert(index,'Fetching rates...\\n') everytime, the text widget gets validated only when the whole execution completes and the cursor remainis in sandclock mode the whole time. Please help out.

As like most GUI systems, Tkinter is basically a single threaded system.So,when the operation begins in Excel sheet,your GUI stops responding.Try using update_idletasks() if you want to force the GUI to show the text.

For more details,visit this

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