Setting image background colour in text widget? 
Author Message
 Setting image background colour in text widget?
Is it possible to set the background colour for an embedded image in a
text widget? (The image has a "transparent" background).

Many Thanks,
   =Adrian=



Sat, 03 Feb 2007 17:25:04 GMT  
 Setting image background colour in text widget?
Is it possible to set the background colour for an embedded image in a
text widget? (The image has a "transparent" background).

Many Thanks,
   =Adrian=



Sat, 03 Feb 2007 17:27:43 GMT  
 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.



Sun, 04 Feb 2007 04:45:16 GMT  
 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.



Sun, 04 Feb 2007 05:04:30 GMT  
 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,

Sorry, my original message wasn't very clear.

If I set the background colour of the text widget, this does indeed
set the background for all images embedded in the widget. What I want
to be able to do is set the background colour individually for each
embedded image. Each image may (potentially) have a different
background colour.

Many Thanks,
   =Adrian=



Mon, 05 Feb 2007 19:12:20 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Is it possible to have a background image in a text widget

2. Background image in a text widget

3. Changing image background colour on canvas?

4. can't make image and background colour match

5. text widget: select color on text with background

6. ImageDraw.text gets colour wrong in PIL for GIF images

7. setting colour and font for scrolledText widget label

8. Printing colour images on a colour printer

9. Setting size of widgets embedded in a text widget

10. Some questions on elided text in the text widget (and a few other text widget questions)

11. How to set toplevel widget background color?

12. How to set background of text label in Diagram window

 

 
Powered by phpBB® Forum Software