simple TkInter question - labels

H

headspin

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.
 
J

James Stroud

headspin said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top