Created
November 27, 2014 22:27
-
-
Save Cheaterman/821f52405e86fdb5ddde to your computer and use it in GitHub Desktop.
size_hint and pos_hint demonstration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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