I want to highlight specific rows in a gtk.Table
. I also want a mouseover to highlight it w/ a different color (like on a link in a web browser). I thought of just packing each cell with an eventBox and changing the STATE_NORMAL
and STATE_PRELIGHT
bg colors, which does work, but mousing over the eventbox doesn't work. Is there a better way?
views:
170answers:
1
+1
A:
This seems to work:
def attach(w,c1,c2,r1,r2):
eb = gtk.EventBox()
a = gtk.Alignment(xalign=0.0,yalign=0.5)
a.add(w)
eb.add(a)
eb.set_style(self.rowStyle)
def ene(eb,ev):
eb.set_state(gtk.STATE_PRELIGHT)
def lne(eb,ev):
eb.set_state(gtk.STATE_NORMAL)
eb.connect('enter-notify-event', ene)
eb.connect('leave-notify-event', lne)
self.table.attach(eb, c1, c2, r1, r2,
xoptions=gtk.EXPAND|gtk.FILL,
yoptions=gtk.SHRINK)
It only highlights each cell at a time, so I'll have to change the notify events to light up everything.
Claudiu
2009-08-07 02:05:18