盒子布局加之嵌套布局
1 from kivy.app import App 2 from kivy.core.text import LabelBase 3 from kivy.uix.boxlayout import BoxLayout 4 5 LabelBase.register("Roboto", "msyhl.ttc") 6 7 8 class Test7Layout(BoxLayout): 9 """盒子布局之嵌套布局""" 10 11 def __init__(self, **kwargs): 12 super(Test7Layout, self).__init__(**kwargs) 13 14 15 class Test7App(App): 16 def build(self): 17 return Test7Layout() 18 19 20 if __name__ == '__main__': 21 Test7App().run()
kv语言:
1 <Test7Layout>: 2 orientation:'vertical' 3 Button: 4 text:'只有永不遏止的奋斗' 5 Button: 6 text:'才能使青春之花' 7 BoxLayout: 8 orientation:'horizontal' 9 Button: 10 text:'即便是凋谢' 11 Button: 12 text:'也是壮丽地凋谢'
运行界面显示:
标签:__,入门,text,Button,布局,kivy,Test7Layout From: https://www.cnblogs.com/shixiaogu/p/16730262.html