Pygtk changes the background color of the gtkHBox widget

I have a gtk ui that has gtkVBox that gets a gtkHbox containing content dynamically added to it when the user is working.

Ui is getting crowded, and it's hard to tell which component the Hbox belongs to (they repeat.)

I would like to change the background color of gtkHboxes so that it alternates between a lighter and darker color for each of them.

Basically, I create a dynamic combo box table where each row represents an object. Now I need to segment the lines, as they are quiet and complex.

Thanks, Dave.

+7
source share
1 answer

According to the docs , since the hbox "has no window connected," you cannot directly change the background color. Documents offer to wrap it and the event field. This works pretty well:

hbox = gtk.HBox() eb = gtk.EventBox() eb.add(hbox) eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(red=65535)) 
+13
source

All Articles