Skip to content

Instantly share code, notes, and snippets.

@kived
Created June 29, 2015 21:51
Show Gist options
  • Save kived/a5c6d900018c90236dbf to your computer and use it in GitHub Desktop.
Save kived/a5c6d900018c90236dbf to your computer and use it in GitHub Desktop.
Kivy: dock demo
import kivy
kivy.require('1.9.0')
from kivy.app import App
from kivy.lang import Builder
root = Builder.load_string('''
AnchorLayout:
anchor_x: 'left'
StackLayout:
orientation: 'lr-tb'
size_hint: None, None
height: self.minimum_height
width: 1
Button:
size_hint: None, None
width: self.texture_size[0] + dp(12)
height: self.texture_size[1] + dp(12)
text: 'Hello, this is a long message here'
Button:
size_hint: None, None
width: self.texture_size[0] + dp(12)
height: self.texture_size[1] + dp(12)
text: 'Hello world'
Widget:
size_hint_y: None
height: dp(12)
Button:
size_hint: None, None
width: self.texture_size[0] + dp(12)
height: self.texture_size[1] + dp(12)
text: 'Bye'
''')
class TestApp(App):
def build(self):
return root
if __name__ == '__main__':
TestApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment