[Tutor] label widgets: double buffering, clearing label text

alan.gauld@bt.com alan.gauld@bt.com
Mon Nov 18 06:10:03 2002


> uses double buffering, so you can update the contents at any time,
> without annoying flicker."
> 
> Does anyone know how to use label widgets in this way?
> 
> How about simply clearing label widget text in order to 
> update the text?

The point is you don't need to.
You just assign the text property to some new string:

label['text'] = "A first string"
label['text'] = "A new string"

And Tkinter will display the new value without redrawing 
the entire window and hence causing any flickers.

The only thing to watch out for is Tkinter may resize the window 
if the new string is significantly longer or shorter. To get 
round that put the label inside a fixed size frame....

Alan g.
Author of the 'Learning to Program' web site
http://www.freenetpages.co.uk/hp/alan.gauld