Chaining Boxlayouts

Date: February 25th 2016
Last updated: February 25th 2016

This is my ugly term for adding more than one boxlayout in the kv file. If there is a proper name I haven't seen it yet.

main.py

import kivy
kivy.require('1.9.1')
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout

class Sample(BoxLayout):
    pass

class SampleApp(App):
    def build(self):
        return Sample()

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

sample.kv

#:kivy 1.9.1
<Sample>:
    orientation: 'vertical'

    BoxLayout:
        orientation: 'vertical'
        Label:
            text: 'Test label at V1 position'
        ToggleButton:
            text: 'Test ToggleButton at V2 position'

    BoxLayout:
        orientation: 'horizontal'
        Button:
            text: 'Guess!'
        Button:
            text: 'Clear'
        Button:
            text: 'Quit'

Output
Note that I included orientation vertical at the start of the kv file. If I omitted this line the layout would be default to something different. I have also clicked the ToggleButton in V2 position which is why it's coloured blue. None of these buttons do anything.

chaining boxplots screenshot

results matching ""

    No results matching ""