
Setting image background colour in text widget?
Quote:
> Is it possible to set the background colour for an embedded image in a
> text widget? (The image has a "transparent" background).
I'm sorry, but I don't fully understand what you're asking for there.
Images in text widgets (or elsewhere for that matter) which have
transparent bits are supposed to show whatever is behind the image
(the widget background in the case of text widgets) in the transparent
bits. I even believe that that happens correctly now (things are a
bit more complex with semi-transparent images; they're computationally
much more expensive, require an extension to load into Tk, and were
not displayed correctly until a few months ago.)
So, the correct way to set the "background" for an embedded image is
to set the background of the widget. But I suspect that you're after
something else, yes? Where you're setting the background colour to
something non-standard, perhaps?
If you've got Tk 8.4, you can copy the image onto another one (I'd
suggest filling the target of the copy with your preferred background
colour first) with the "overlay" compositing rule. That should do the
trick, and it ought to be relatively fast too. (I can't remember if
that works in 8.3; I've tinkered with that code so much I don't
exactly recall what state it was in originally. Other than "in need
of work", obviously. :^)
Donal.