<StackLayoutWidget>:
# ['lr-tb', 'tb-lr', 'rl-tb', 'tb-rl', 'lr-bt', 'bt-lr', 'rl-bt', 'bt-rl']
orientation: 'lr-tb'
canvas:
Color:
rgba: [1, 1, 1, 1]
Rectangle:
size: self.size
pos: self.pos
Button:
text: 'B1'
size_hint: [.2, .1]
Button:
text: 'B2'
size_hint: [.2, .1]
Button:
text: 'B3'
size_hint: [.2, .1]
Button:
text: 'B4'
size_hint: [.2, .1]
Button:
text: 'B5'
size_hint: [.2, .1]
Button:
text: 'B6'
size_hint: [.2, .1]
Button:
text: 'B7'
size_hint: [.2, .1]
Button:
text: 'B8'
size_hint: [.2, .1]
Button:
text: 'B9'
size_hint: [.2, .1]
Button:
text: 'B10'
size_hint: [.2, .1]
from kivy.app import App
from kivy.uix.stacklayout import StackLayout
class StackLayoutWidget(StackLayout):
def __init__(self, **kwargs):
super().__init__(**kwargs)
class StackApp(App):
def build(self):
return StackLayoutWidget()
if __name__ == '__main__':
StackApp().run()
kivy学习完全解析 009 堆栈布局
最新推荐文章于 2024-04-17 09:44:59 发布