Re: dynamically changing color of labels and edit boxes



2005/8/17, Faria, Sydney C <sydney faria pw utc com>:
Is there a way to change the color of the text displayed in an edit box
after the text has been put into the edit box?  I have a need to do range
checking on edit box entries and would like to change the text color to red
if the value entered is out of range.  I have a similar need to do this with
labels, and have done this of using a Pango markup: is there an easier way?

you can use gdk_color_parse
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Colormaps-and-Colors.html#gdk-color-parse

and then gtk_widget_modify_fg on the label
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-modify-fg

hope it helps
cheers
-- 
Gian Mario Tagliaretti
PyGTK GUI programming
http://www.parafernalia.org/pygtk/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]