[Tutor] removing an image from a tkinter label
singingxduck at gmail.com
Wed Nov 15 05:30:36 CET 2006
Orri Ganel wrote:
> Hello all,
> As part of a tkinter program that displays the currently playing
> track's information (including artwork) from iTunes, I have a label
> with an image in it (the artwork). However, when the song played
> doesn't have artwork, I'd like to remove artwork of the old song and
> replace it with the text "No artwork". However, I can't seem to find
> a way to do that. Short of destroying the label and creating a new
> one, is there another way to accomplish this? The relevant code
> appears below.
> Thanks in advance,
In the end, setting lbl["image"] = "" worked (as opposed to None, which
raises a TclError with the message that pyimage2 or whatever number of
pictures had been put in so far didn't exist). This is a surprisingly
underdocumented fact, however. Googling various combinations of
Tkinter, label, image, and remove, failed to yield a fruitful result
until the 4th or 5th page of the 5th or so combination.
In any case, thanks for your time.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 144 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20061114/31d01d9f/attachment-0001.vcf
More information about the Tutor