View Single Post
Posts: 883 | Thanked: 980 times | Joined on Jul 2007 @ Bern, Switzerland
#12
Originally Posted by rambo View Post
Basically I have a hildon.Button (also tried with plain gtk.Button) and I want to change the background color between red and green based on state changes.

1. Put the whole button inside eventbox and change eventbox background (the "official" GTK workaround to the fact that buttons do not generally allow background to be messed with), does "nothing" (ie the button with the default background and all is drawn on top of the eb).

2. Put the first child of the hildon.Button (gtk.Alignment) inside the eventbox: makes ugly mess where there is rectangular box inside the button area with the gray button borders visible, click only works if done in the gray border (i guess the eventbox could be connected to the signals as well, but since this looks fugly I didn't bother experimenting with that).
I spent yesterday evening right on the same problem, fighting with eventbox et. al., but couldn't yet find a solution.
Depending on your GUI layout, you might try to work with a gtk.Toolbar(), which then accepts a gtk.ToolButton() with an icon.
And this might help, too: PyGTK FAQ, How do I create buttons that contain a pixmap?
__________________
-Tom (N900, N810, N800)

"the idea of truly having a computer in your pocket just moved a big step closer."

Last edited by twaelti; 2010-02-12 at 08:53.