On Thu, Jan 16, 2003 at 11:01:47AM +0800, James Henstridge wrote:
> george young wrote:
>
> >[python-2.2.1, gtk-2.1.1 pygtk-1.99.14, linux]
> >How can I change the grey background of an insensitive gtk.Entry?
> >I tried:
> > self.entry = gtk.Entry()
> > map=self.entry.get_colormap()
> > red=map.alloc('red')
> > style=self.entry.get_style().copy()
> > style.bg[gtk.STATE_INSENSITIVE] = red
> > self.entry.set_style(style)
> >
> >from the FAQ, but it seemed to have no effect. Trying to set the
> >foreground color
> >likewise had no effect...
> >
> >I need the insensitive entry to be a much lighter grey (or the foreground
> >to be
> >a full black) because it's too hard to read. This widget gets dynamically
> >switched
> >between writable and read-only during the session. But even when
> >read-only, it needs to
> >be easily and clearly readable. I could just manipulate 'editable', but
> >then it still
> >accepts the focus and frustrates people who try to type at it.
> >
> >
> Trying to change the default appearance like this can actually be
> harmful when you take theming into account. If you don't like the way
> the insensitive widgets are displayed, I suggest you try using another
> theme.
>
Might a suitable solution be to set the entry as not editable,
and then call unset_flags(gtk.CAN_FOCUS) on the Entry?
Also, as James told you, you need to modify the base. In GTK 2.0 there
are some convenience methods for GtkWidgets. You can simply call:
self.entry.modify_base(red) if you decide to go the base changing route.
-jkl
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/