b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

pango markup_markup公式_markup用法(5)

电脑杂谈  发布时间:2017-06-08 15:06:17  来源:网络整理

Once you have set the default font, you can change around the appearance of specific blocks of text using Pango markup. This is done by calling the method. The markup below shows how text is customized in Pango. The block of text in the tag specifically overrides some of the default settings made earlier through set_font_description().

                #Set the markup for our pango layout. 
		self.pango_layout.set_markup('<span foreground=\"blue\">This is some sample markup</span> 
<sup>text</sup> that <span style=\"normal\" size=\"small\">is displayed with pango</span>\n\n <u>Current time:</u> ')

The screenshot below shows how the text above shows up after setting the default font earlier and then customizing with the markup.

pango markup_markup用法_markup公式

Yes, in fact some widgets like gtk.Label already have built in methods to set pango markup. This makes the process of creating custom Pango text extremely easy. In fact, if you just want some small or area of text in your activity UI, you might be better served creating a gtk.Label and using the set_markup() method that comes built in for use with Pango. Of course, if labels, tooltips or other widgets are not sufficient for what you are trying to do with your UI, you will have to revert to using more broad-purpose widgets like the gtk.DrawingArea.

Below is some code that creates a label, sets its text to be Pango markup and then adds it to some existing UI widget (called first_page).


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-51835-5.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    每日福利