remove inner border on gtk.Button

孤人 提交于 2019-12-24 20:02:37

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!