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.
Asked
Active
Viewed 333 times
0

raul
- 1,209
- 7
- 20
- 36
1 Answers
1
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
-
you are welcome buddy ;). You should try the make the whole UI responsive though – Alok Mar 05 '14 at 08:18
-
I'm a newbie. Could you elaborate? – raul Mar 05 '14 at 08:25
-
What i'm trying to say is you should try to use root.update_idletasks or frame.update... or canvas.update... or whatever it is you are using so that your whole UI is responsive & not just the text area – Alok Mar 05 '14 at 08:28
-
hey, why does the application go gray (title bar says 'Not Responding') when I click anywhere on the window when idletasks is doing its job? – raul Mar 06 '14 at 04:33
-
that means your `update_idletasks` is not doing its job properly,which means you haven't used it well. Like i said yesterday,don't use it with a widget,but with the root or frame or canvas. – Alok Mar 06 '14 at 04:39
-
You have to use that code where it is creating excel sheet,so that it gets called multiple times – Alok Mar 06 '14 at 04:41
-
Same problem with root.idletasks(). I am using it immediately after every text.insert() – raul Mar 06 '14 at 04:48
-
`root.update_idletasks`. Not after every `text.insert`. You must be running some loop for writing data to excel sheet.Include `update_idletasks` there,so that every time some data is written,the next thing it would run is `upate_idletasks` – Alok Mar 06 '14 at 04:51