1,Label
遗留问题:加上 markup: True之后,文本不显示了
解决方法:把text_size和color属性注释掉就出现了
kivytest.py
# coding:utf-8 from kivy.app import App from kivy.uix.floatlayout import FloatLayout from kivy.uix.label import Label class KvTest(FloatLayout): def __init__(self, **kwargs): super().__init__(**kwargs) def label_ref(self, label): print('ref事件被触发了') def label_ref_03(self): print('ref_03事件被触发了') Label class KvTestApp(App): def build(self): return KvTest() if __name__ == '__main__': KvTestApp().run()kvtest.py
kivytest.kv
<KvTest>: Label: text: '[s][ref=label]AAAA[/ref][/s]' #font_size: '30px' text_size: (100, 100) color: (255,22,1,1) valign: 'top' # 当需要设置标记文本的时候,需要将markup设置为 True # markup: True on_ref_press: root.label_ref(self) print('这是第二个事件。。。。') root.label_ref_03()kvtest.kv
标签:__,python,self,label,kv,kivy,Label,ref From: https://www.cnblogs.com/147258llj/p/17501858.html