Pygtk: Change a widget’s border color


I have looked everywhere but couldn't seem to find a way to change the color of the border.
For example I need a button like this:

gb = gtk.Button("Hi")

Now I wish to color the border red (this is a non-existent call):


I tried gb.modify_bg(…) but it only changes the background of the button, not the BORDER surrounding it. The closet thing I can get is adding this GtkButton to a GtkFrame, and use the frame's shadow color. However the shadow box's width is fixed – it's a thin line way below my desired thickness.

It's intuitive to me that if you can change the width of a border, you should be able to set more styles on it. I am open to other ways to achieve the same thick-colored-border effect, such as laying the button on top of some big, colored background?

Thanks for any help here.

Best Solution

AFAIR, gtk.Button border handling is engine-dependent. If you don't want to mess with styles, you could create gtk.EventBox, set its background color, pack the button, and then set the amount of empty space around the button to desired value:

button = gtk.Button("Click me")
eb = gtk.EventBox()
eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("pink"))