gtk.Entry Colors
Tuomas
tuomas.vesterinen at pp.inet.fi
Mon Sep 25 02:35:53 EDT 2006
MonkeeSage wrote:
> Tuomas wrote:
>
>>I would like to manipulate PyGTK Entry widget's background and
>>foreground colors. Is it possible? How?
>
>
> Yes, it is possible:
>
> # widget color
> entry.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse("#FF0000"))
> # frame color
> entry.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#0000FF"))
> # text color
> entry.modify_text(gtk.STATE_NORMAL, gtk.gdk.color_parse("#00FF00"))
Thanks a lot.
> See:
> http://www.pygtk.org/pygtk2reference/class-gtkwidget.html
> http://www.pygtk.org/pygtk2reference/class-gdkcolor.html
Yes, I read the reference before posting here. I tried something like:
attr_list=pango.AttrList()
attr=pango.AttrForeground(0, 0, 65000, start_index=0, end_index=-1)
attr_list.insert(attr)
entry.get_layout().set_attributes(attr_list)
or
entry.window.set_background(gtk.gdk.color_parse("#0000FF"))
but they did not work for this purpose.
Tuomas
> Regards,
> Jordan
>
More information about the Python-list
mailing list