Skip to content

Instantly share code, notes, and snippets.

@brousch
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save brousch/8806515 to your computer and use it in GitHub Desktop.

Select an option

Save brousch/8806515 to your computer and use it in GitHub Desktop.

Revisions

  1. brousch revised this gist Feb 4, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions main.py
    Original file line number Diff line number Diff line change
    @@ -7,10 +7,10 @@
    <Test>:
    orientation: 'horizontal' if root.width > root.height else 'vertical'
    Button:
    text: "{}x{}".format(self.width, self.height)
    text: "Button1\\n{}x{}".format(self.width, self.height)
    size_hint: (None, 1) if root.width > root.height else (1, None)
    Button:
    text: "{}x{}".format(self.width, self.height)
    text: "Button2\\n{}x{}".format(self.width, self.height)
    size_hint: (0.75, 1) if root.width > root.height else (1, 0.75)
    """

  2. brousch renamed this gist Feb 4, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. brousch created this gist Feb 4, 2014.
    30 changes: 30 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    from kivy.app import App
    from kivy.lang import Builder
    from kivy.uix.boxlayout import BoxLayout


    kv = """
    <Test>:
    orientation: 'horizontal' if root.width > root.height else 'vertical'
    Button:
    text: "{}x{}".format(self.width, self.height)
    size_hint: (None, 1) if root.width > root.height else (1, None)
    Button:
    text: "{}x{}".format(self.width, self.height)
    size_hint: (0.75, 1) if root.width > root.height else (1, 0.75)
    """

    Builder.load_string(kv)


    class Test(BoxLayout):
    def __init__(self, **kwargs):
    super(Test, self).__init__(**kwargs)


    class TestApp(App):
    def build(self):
    return Test()

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