Skip to content

Instantly share code, notes, and snippets.

@Cheaterman
Created November 27, 2014 22:27
Show Gist options
  • Save Cheaterman/821f52405e86fdb5ddde to your computer and use it in GitHub Desktop.
Save Cheaterman/821f52405e86fdb5ddde to your computer and use it in GitHub Desktop.
size_hint and pos_hint demonstration
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import Screen
class TestScreen(Screen):
def __init__(self, *args, **kwargs):
super(TestScreen, self).__init__(*args, **kwargs)
layout = BoxLayout(
orientation='vertical',
spacing=5,
padding=10,
size_hint_y=1 / 3.,
pos_hint={'top': 1}
)
for i in range(1, 4):
layout.add_widget(Button(text='Button %d' % i))
self.add_widget(layout)
class TestApp(App):
def build(self):
return TestScreen()
if __name__ == '__main__':
TestApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment