问题
I would like to remove border on a gtk.Button and also set its size fixed. How can I accomplish that? My button looks like that:
b = gtk.Button() b.set_relief(gtk.RELIEF_NONE)
Thanks! p.d: I'm using pygtk
回答1:
You can use gtk.Widget.set_size_request to set a fixed size for the widget. Note that this is generally a bad idea, since the user may want a larger font size than you had planned for, etc.
As for removing the border, gtk.Button can often take up more space than you wish it would. You can try to set some of the style properties such as "inner-border" to 0 and see if that gets the result you want. If you need the smallest button possible, you should just gtk.Label inside a gtk.EventBox and handle clicks on the event box. That will use the least amount of pixels.
回答2:
I don't think the EventBox can send button events like "activated" and "clicked".
来源:https://stackoverflow.com/questions/1383663/remove-inner-border-on-gtk-button