删除gtk.button的边框 [英] remove border of a gtk.button

查看:158
本文介绍了删除gtk.button的边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除gtk.button的边框,但我不知道该怎么做。

I want to remove the border of the gtk.button, but i Don't know how to do it.

我试过:

button = gtk.Button()
button.set_style("inner-border",0)

但是我有一个错误:属性不存在。
我也尝试创建一个新的gtk.Style并将其用于该按钮,但同样的错误。

but i have an error : the property doesn't exist. I tried too to create a new gtk.Style and use it for the button, but same error.

任何人都有想法?

感谢

Thanks

推荐答案

设置按钮的 relief property:

Set the button's relief property:

button.props.relief = gtk.RELIEF_NONE

完整测试程式:

Full test program:

import gtk

window = gtk.Window ()
box    = gtk.VButtonBox ()

for k in range (10):
    button = gtk.Button ('button %d' % k)
    if k % 2 == 0:
        button.props.relief = gtk.RELIEF_NONE

    box.add (button)

window.add (box)
window.show_all ()

gtk.main ()

如果这不适用于您,那么您的GTK +主题不支持 RELIEF_NONE

If this doesn't work for you, then your GTK+ theme doesn't support RELIEF_NONE.

这篇关于删除gtk.button的边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆