I have a small problem with 'gtk.Entry'. Indeed I would like to change the color of the text of the Entry, but I don't know how.
I tried to modify the pango.Layout of the Entry (see the small example bellow), but I didn't work (the text of the Entry was expected to become red).
# File example.py
import gtk
import pango
def entry_changed_callback(entry):
end_index = entry.get_text().__len__()
print end_index
color = pango.AttrForeground(65535, 0, 0, 0, end_index)
l = pango.AttrList()
l.insert(color)
entry.get_layout().set_attributes(l)
window=gtk.Window()
entry = gtk.Entry()
entry.connect('changed', entry_changed_callback)
window.add(entry)
window.show_all()
gtk.main()
# End of file
Did I make something wrong ? Or is there a way to do it in a different way ?
Thanks in advance for any help provided !
--
Remi
_______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
