屬性我有下面的代碼,使用的PyGTK:攀高與pygobject
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.AttrFamily,既不Pango.AttrWeight,既不攀高.AttrForeground(我無法實例化Pango.AttrSize)。
的問題是:如何使用pango_attr_size_new
,pango_attr_weight_new
,通過instrospection pango_attr_family_new
和pango_attr_foreground_new
?
我知道我可以使用markup來做到這一點,但1.使用屬性會使事情變得簡單,2.我想知道這裏發生了什麼!我已經花了很多時間來解決它。
你有沒有得到這個地方?我有同樣的問題。 – 2012-08-19 01:48:07
FIY,這裏是相關問題: https://bugzilla.gnome.org/show_bug.cgi?id=646788(自2014年起不變) – 2016-05-25 22:44:47
這還沒有被修復。但是你可以通過使用新的CSS系統來解決它:'#mylabel {color:blabla; etc'},設置'self.label.set_name(「mylabel」)',然後導入CSS文件'Gtk.CssProvider.load_from_file(Gtk.CssProvider_get_default(),file)'。 – 2016-07-02 23:20:13