Created
November 12, 2014 07:01
-
-
Save Cheaterman/9f310da533d841a19fc2 to your computer and use it in GitHub Desktop.
Simple KV loop
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
__author__ = 'Cheaterman' | |
from functools import partial | |
from kivy.app import App | |
from kivy.uix.widget import Widget | |
from kivy.lang import Builder | |
kv = """ | |
#:import Button kivy.uix.button.Button | |
<TestWidget>: | |
GridLayout: | |
pos: 100, 100 | |
size: 100, 100 | |
cols: 3 | |
rows: 3 | |
on_parent: | |
if not self.children: \ | |
[self.add_widget(Button(text=str(i))) for i in range(1, 10)] | |
""" | |
Builder.load_string(kv) | |
class TestWidget(Widget): | |
pass | |
class TestApp(App): | |
def build(self): | |
return TestWidget() | |
if __name__ == '__main__': | |
TestApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment