[pygtk] enty with an image as background
Alessandro Dentella
sandro at e-den.it
Sun Mar 15 03:27:14 WST 2009
Hi,
I wanted to implement an entry with a simple image as background, mainly
to warn if a validation error was raised.
I thought I could use style property bg_pixmap but I can't work out how it
should work. Here is the code I tried (of course I copied error.png in the
same directory).
Any hint is appreciated. Thanks
sandro
*:-)
class W(object):
def __init__(self):
w = gtk.Window()
self.e = gtk.Entry()
w.add(self.e)
w.show_all()
self.pixbuf = gtk.gdk.pixbuf_new_from_file('error.png')
self.pixmap, self.mask = self.pixbuf.render_pixmap_and_mask()
style = self.e.get_style().copy()
style.bg_pixmap[gtk.STATE_NORMAL] = self.pixmap
self.e.set_style(style)
w = W()
--
Sandro Dentella *:-)
http://sqlkit.argolinux.org SQLkit home page - PyGTK/python/sqlalchemy
More information about the pygtk
mailing list