【Kivy】StackLayout を利用して敷き詰めるように並べる

  • main.py
from kivy.app import App

class MainApp(App):
    pass

if __name__ == '__main__':
    MainApp().run()
  • main.kv
#:kivy 1.0
StackLayout:
    Button:
        text: 'button 1'
        size_hint: None, None
        size: 400, 80
    Button:
        text: 'button 2'
        size_hint: None, None
        size: 500, 160
    Button:
        text: 'button 3'
        size_hint: None, None
        size: 300, 200
    Button:
        text: 'button 4'
        size_hint: None, None
        size: 120, 400
    Button:
        text: 'button 5'
        size_hint: None, None
        size: 800, 80
    Button:
        text: 'button 6'
        size_hint: None, None
        size: 600, 200

youtu.be