我有以下使用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)
我正在尝试将其移植到pygobject,但没有类盘古属也没有盘古吸引子也没有Pango.AttrForeground公司(我不能实例化Pango.AttrSize公司). 在
问题是:如何通过透视法使用^{
我知道我可以用markup来做这个,但是1。使用属性可以使事情更简单。我想知道这里发生了什么!我已经花了很多时间试图解决它。在
从这个mail我发现这个运行没有运行时错误:
虽然在我的代码中这并没有使内容向右对齐,但我的代码中可能有另一个错误。这里最重要的是,上面的代码似乎是pygtk的翻译,比如
import pango
和:pango.ALIGN_RIGHT
这并不是OP的完整答案,但希望能更近一步。在
编辑:由于方法
override_font
已被弃用,您应该按照本页的描述使用CSS-https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-override-font剩下的答案留作历史之用。在
我不知道为什么这样不行。在
这里有一个方法。在
到目前为止我找到的最简单的方法。 迟答总比不回答好。在
以防Pango的一些资源,并使用上面的代码。 我不确定Pango的所有文档是否都适用于gtk3,但它对我有用。在
Pango context set font description
Pango font description
Pango fonts in gtk
Pango layout
GtkWidget inherited by text editors在其他对象中。在
相关问题 更多 >
编程相关推荐