simple TkInter question - labels

James Stroud jstroud at mbi.ucla.edu
Tue Dec 13 17:29:15 EST 2005


headspin wrote:
> I know how to switch a label from text to an image; simply config the
> image property to an existing image.
> 
> But how do you do the opposite? Once a label displays an image, how do
> you switch it back to displaying text? Setting the image property to
> None doesn't seem to do the trick.
> 
> By the way, I initially tried to write my (very simple) app with
> wxPython, but couldn't deal with the documentation.
> 

 From the Tk documentation

"Typically, if the image option is specified then it overrides other options 
that specify a bitmap or textual value to display in the widget; the image 
option may be reset to an empty string to re-enable a bitmap or text display."

So try setting to an empty string instead of None.

For many Tkinter issues, you can try:
<http://www.astro.princeton.edu/~rhl/Tcl-Tk_docs/tk8.0a1/contents.html>

James



More information about the Python-list mailing list