English 中文(简体)
Pango Markup
原标题:Variable in Pango Markup

我正在使用Adhur 2.7和PyGObject 3.0。 (这很重要!) PyGObject syntax 改为3.0!)

我需要作一个变量,以代替标记,因此产出的形式。 这是我制定的在标签上编排标准标识的代码。

lbl_tile1.set_markup( <span font_family="serif" font = "48" weight = "bold">W</span> )

然而,我需要将数据用于一个变量。 以下修改案文,但删除格式。

lbl_tile1.set_markup( <span font_family="serif" font = "48" weight = "bold">W</span> )
lbl_tile1.set_text(t[0])

我需要将变数的“t[0]”改为“W”,以示格式。 我如何这样做?

最佳回答

你们不需要使用一套文字方法。 你们可以把数据放在编号方法上。

例如:

lbl_tile1.set_markup( <span font_family="serif" font = "48" weight = "bold">{0}</span> .format(t[0]))
问题回答

暂无回答




相关问题
using gtktextbuffer and Pango

I have some text in GtkTextBuffer with certain attribute properties like bold, italic. I want to extract those text having those properties using Pango.

Getting text bounds in GTK+

How can I get bounds of a text, provided string with attributes say, font size, font style, and font family in GTK+?

-package Cabal-1.8.0.6 breaks pango installation on Mac

When installing Haskell pango on mac (sudo cabal install pango), the first problem is that it tries to install packages I ve already installed. I ve install haskell98 (successfully), but pango tries ...

GTKSharp, Pango, set font size quirkiness

I m using GTK Sharp to work on some GUI for my app. Take a look at this chunk of code: Pango.FontDescription fontdesc = new Pango.FontDescription(); fontdesc.Family = "Sans"; //fontdesc.Size = 12; ...

How do I do text wrapping in pyCairo + Pango?

What I need pyCairo to do is : generate an image of size 100x100 containing some text and an image from filesystem as background the text should be within a box which has text wrapping of size 20x20 ...

热门标签