views:

95

answers:

1

I would like to create a button that I can control the look of the button using pyGTK. How would I go about doing this?

I would like to be able to point to a new image for each 'state' the button is in (i.e. Pressed, mouse over, normal...etc.)

+2  A: 

As described in the API documentation for gtk.Image, "If you want to receive events on the image, such as button clicks, place the image inside a gtk.EventBox, then connect to the event signals on the event box.".

You probably want to use a gtk.Image rather than a gtk.Button, since buttons require more knowledge of how the theming engine works. If you really want to use a button, you'll need to read up on gtk rc files and the APIs for manipulating them.

Glyph
Correct answer by Glyph, an Image inside an EventBox is probably the correct way. However, in general UI terms, changing the way a user has set buttons to look (using style-changes) is inherently a bad thing.
Ali A
I definitely agree with that.
Glyph