kivy Label标记文本
from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.lang import Builder # 注意只有text的color是小写 canvas中的Color是大写要加括号 # canvas.before在最下面 # 要激活标记文本 必须加markup:True Builder.load_string(""" <BoxLayoutWidget>: orientation:'vertical' Label: text:' I Link [i]China[/i],very Link ' color:.9,.2,.1,1 markup:True Label: text:'[b]to[/b][sup]2[/sup] be[sub]2[/sub] number one' color:.9,.2,.1,1 markup:True canvas.before: Color: rgba:(1,1,1,1) Rectangle: pos:self.pos size:self.size """) class BoxLayoutWidget(BoxLayout): def __init__(self,**kwargs): super().__init__(**kwargs) class BoxxxxApp(App): def build(self): return BoxLayoutWidget() if __name__ == '__main__': BoxxxxApp().run()
Label标记属性多多不一一展示