小编Mar*_*aro的帖子

pango属性与pygobject

我有以下代码,使用pygtk:

attr = pango.AttrList()
attr.change(pango.AttrSize((
            50 * window_height / 100) * 1000, 0, -1))
attr.change(pango.AttrFamily("Sans", 0, -1))
attr.change(pango.AttrWeight(pango.WEIGHT_BOLD, 0, -1))
attr.change(pango.AttrForeground(65535, 65535, 65535, 0, -1))

self.label.set_attributes(attr)
Run Code Online (Sandbox Code Playgroud)

我正在尝试将它移植到pygobject,但没有类Pango.AttrFamily,既没有Pango.AttrWeight,也没有Pango.AttrForeground(我无法实例化Pango.AttrSize).

现在的问题是:如何使用pango_attr_size_new,pango_attr_weight_new,pango_attr_family_newpango_attr_foreground_new通过instrospection?

我知道我可以使用标记来做到这一点,但是1.使用属性可以使事情更简单2.我想知道这里发生了什么!我已经花了很多时间试图解决它.

python pango pygobject gtk3

9
推荐指数
1
解决办法
1604
查看次数

标签 统计

gtk3 ×1

pango ×1

pygobject ×1

python ×1