Skip to content

Instantly share code, notes, and snippets.

@spillz
Created July 21, 2014 17:15
Show Gist options
  • Save spillz/cb68aca4f4595d13a9fc to your computer and use it in GitHub Desktop.
Save spillz/cb68aca4f4595d13a9fc to your computer and use it in GitHub Desktop.
kivy properties example
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.floatlayout import FloatLayout
Builder.load_string('''
#:kivy 1.6
<MyLayout>:
    my_rect_size: self.size[0]/2, self.size[1]/2
    canvas:
        Color:
            rgba: [0,1,0,1]
        Rectangle:
            pos: self.pos
            size: self.my_rect_size
''')
class MyLayout(FloatLayout):
    pass
class MyApp(App):
    def build(self):
        return MyLayout()
if __name__ == '__main__':
    MyApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment