ボックスレイアウト

2015/10/24

Python 2.7.9, Kivy 1.9.0

# -*- coding: utf-8 -*-

from kivy.app import App
from kivy.lang import Builder

kv = '''
BoxLayout:
    orientation:'vertical'

    Widget:
        size_hint: None, None
        size: root.width, 60

        canvas.before:
            Color:
                rgba: 0.4, 0.4, 0.4, 1
            Rectangle:
                pos: self.pos
                size: self.size
    Widget:
        canvas.before:
            Color:
                rgba: 1, 1, 1, 1
            Rectangle:
                pos: self.pos
                size: self.size
    Widget:
        size_hint: None, None
        size: root.width, 60

        canvas.before:
            Color:
                rgba: 0.6, 0.6, 0.6, 1
            Rectangle:
                pos: self.pos
                size: self.size
'''

class MyApp(App):

    def build(self):
        return Builder.load_string(kv)

if __name__ == '__main__':
    MyApp().run()


Box Layout — Kivy 1.9.1-dev documentation
http://kivy.org/docs/api-kivy.uix.boxlayout.html