Skip to content

Instantly share code, notes, and snippets.

@kived
Created April 21, 2015 16:08
Show Gist options
  • Save kived/7ea69c1d50a775d60f5a to your computer and use it in GitHub Desktop.
Save kived/7ea69c1d50a775d60f5a to your computer and use it in GitHub Desktop.
Kivy: orientation change
FloatLayout:
screen_orientation: 'landscape' if self.width > self.height else 'portrait'
BoxLayout:
orientation: 'vertical'
disabled: root.screen_orientation != 'portrait'
size_hint: (None, None) if self.disabled else (1, 1)
size: (0, 0) if self.disabled else (100, 100)
opacity: 0 if self.disabled else 1
Button
Button
Button
BoxLayout:
orientation: 'horizontal'
disabled: root.screen_orientation != 'landscape'
size_hint: (None, None) if self.disabled else (1, 1)
size: (0, 0) if self.disabled else (100, 100)
opacity: 0 if self.disabled else 1
Button
Button
Button
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment