[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: Okay I got a question regarding Tkinter and Labels

Fredrik Lundh

1/20/2008 12:44:00 PM

Lamonte Harris wrote:

> Okay I've created a script and basically when I loop through a folder it
> is supposed to change the Label everytime it updates a file then again
> it doesn't do nothing but shows the last file edited, whats the best way
> to loop through files and display that file name in a Label's text
> without skipping to the last one when the loop is finished?

Tkinter is event-driven, and you need to keep the event loop running to
make sure that changes to the widgets makes it to the screen.

Usually, this is handled by the "mainloop" function, but if you're
spending considerable time at the Python level, you need to call the
"update" or "update_idletasks" methods from time to time to give Tkinter
a chance to process incoming events. In your case, you can simply call
the method after you've modified the label:

label.config(text="something")
label.update()

Hope this helps!

</F>