[pygtk] changing the foreground colour of entry box dynamically

Tim Evans t.evans at aranz.com
Thu Apr 9 06:30:06 WST 2009


ganesh gajare wrote:
> Hello,
>  I have created an entry box widget using glade.
>  and I am doing validation on that field...
>  So whenever an invalid text is entered in the entry box,the text color 
> of entry should change dynamically..

I haven't tested this, but the method 'modify_text' should do what you 
need.  For example, to set the text to red, use:

     entry.modify_text(gtk.gdk.color_parse('red'))

and to set it back to the default black:

     entry.modify_text(None)

-- 
Tim Evans
Applied Research Associates NZ
http://www.aranz.com/


More information about the pygtk mailing list