Created
August 11, 2013 20:26
-
-
Save Kovak/6206701 to your computer and use it in GitHub Desktop.
Nesting Box Layouts in Kivy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.app import App | |
from kivy.uix.togglebutton import ToggleButton | |
from kivy.uix.widget import Widget | |
from kivy.uix.boxlayout import BoxLayout | |
class HBoxWidget(Widget): | |
def __init__(self, **kwargs): | |
super(HBoxWidget, self).__init__(**kwargs) | |
class VBoxWidget(Widget): | |
def __init__(self, **kwargs): | |
super(VBoxWidget, self).__init__(**kwargs) | |
class ContainerBox(BoxLayout): | |
def __init__(self, **kwargs): | |
super(ContainerBox, self).__init__(**kwargs) | |
class TestApp(App): | |
def build(self): | |
return ContainerBox() | |
if __name__ == '__main__': | |
TestApp().run() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<HBoxWidget>: | |
BoxLayout: | |
size: root.size | |
pos: root.pos | |
id: boxlayout_h | |
orientation: 'horizontal' | |
ToggleButton: | |
text: 'h1' | |
group: 'test' | |
ToggleButton: | |
text: 'h2' | |
group: 'test' | |
<VBoxWidget>: | |
BoxLayout: | |
orientation: 'vertical' | |
size: root.size | |
pos: root.pos | |
ToggleButton: | |
text: 'v1' | |
group: 'test' | |
ToggleButton: | |
text: 'v2' | |
group: 'test' | |
<ContainerBox>: | |
orientation: 'horizontal' | |
HBoxWidget: | |
VBoxWidget: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to your code. I can build my layout with boxlaytout and nesting gridlayout :-)