On Thu, 11 Jan 2001, Frank Ronny Larsen wrote:

> > [EMAIL PROTECTED] wrote:
> > > Ya, I see that there's a set_foreground and set_background command there.
> > > I was hoping to be able to set all these in one operation using
> > > set_row_style, but it doesn't seem to be possible to set the color in
> > > GtkStyles with pygtk.
> > 
> > Yes it is.  Just asign to the items in the style.fg or style.bg
> > sequences:
> >   style.fg[NORMAL] = some_gdkcolor object
> 
> I tried this using just style.fg = some_gdkcolor_object. Obviously that
> didn't work.
> Where do the [NORMAL] come from? (and what are the alternatives
> besides NORMAL)
> If this is what needs to be done this solves a lot. Thanks!

(oops.  that should have been STATE_NORMAL)

A widget has a number of states.  They are STATE_NORMAL, STATE_ACTIVE,
STATE_PRELIGHT, STATE_SELECTED and STATE_INSENSITIVE.  Different colours
can be assigned to each state.  NORMAL is the normal state, ACTIVE is when
a button is pressed for example, PRELIGHT is when the mouse hovers over
the widget, SELECTED is when the widget is selected and DISABLED is when
it is disabled.

> 
> > The sequences are special types that will set the appropriate structure
> > member at the C level.
> 
> > > On that note: When inserting text into a text-box it is possible to set
> > > the fore- and background colors of the text. Is there a way to make the
> > > background color last until the end of the textbox? Ie. I use a gtk-skin
> > > which makes the textbox have a blue background. When I insert text with
> > > white background the background is only present beneath the actual text,
> > > which gives a blue outline around the lines.
> > 
> > You mean a GtkText widget?  If so, then the insert() method should allow
> > you to do this.  If you mean a GtkEntry, then it only allows a single
> > colour (set by the widget's style).
> 
> Yes, I mean the GtkText widget. I am setting the color in the insert
> method and this works fine except the color is only present directly
> beneath the inserted text. From the end of the textline until the right
> edge of the widget the background color remains the same as the widget had
> before. 

The text widget is not very configurable, so it may not be possible to get
the effects you want.  The GtkText widget is being deprecated in the next
major release of GTK in favour of a much more versatile one (based on the
Tk text widget.

James.


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to