I'm trying to change the color of an entry gtk3 text. already searched everywhere and can not find a way. I think that is with an entry_buffer but I have no idea how to do it. for gtk2 found easily but my project is all in gtk 3. if anyone can help me I would appreciate.
解决方案
So there is this question How to make buttons different colours in Python GTK3 (using gi)? that you might find useful. One of the answers points to an article GTK+ 3 theme: style your applications that explains how you style gtk+ 3 applications in python. It looks like it's exactly what you need. The code below works on Ubuntu 12.04, I could not get it working on Ubuntu 11.04 so I assume you need a relatively recent version of these libraries to do this.
code
from gi.repository import Gtk, Gdk
window = Gtk.Window()
window.connect("destroy", Gtk.main_quit)
screen = Gdk.Screen.get_default()
css_provider = Gtk.CssProvider()
css_provider.load_from_path('style.css')
priority = Gtk.STYLE_PROVIDER_PRIORITY_USER
context = Gtk.StyleContext()
context.add_provider_for_screen(screen, css_provider, priority)
entry = Gtk.Entry(text='Testing..')
window.add(entry)
window.show_all()
Gtk.main()
style.css
GtkEntry {
color: red;
background: blue;
}
screenshot