uxl: add uxllauncher example + button example

This commit is contained in:
Mathieu Virbel 2010-11-04 22:36:19 -04:00
parent c996b7e8e2
commit 596c5bec5e
2 changed files with 40 additions and 0 deletions

21
examples/uxl/button.uxl Normal file
View File

@ -0,0 +1,21 @@
#:uxl 1.0
Widget:
Button:
label: "Hello World"
canvas:
Color:
rgb: (1, 0, 0)
Rectangle:
pos: self.pos
Button:
label: "I'm another label"
pos: (200, 200)
canvas:
Color:
rgb: (0, 1, 0)
Rectangle:
pos: self.pos

19
examples/uxl/uxlrun.py Normal file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env python
from kivy.app import App
from kivy.uxl import UxlBuilder
class UxlApp(App):
def build(self):
uxl = UxlBuilder(filename=self.options['filename'])
return uxl.root
if __name__ == '__main__':
import sys
import os
if len(sys.argv) < 2:
print 'Usage: %s filename.uxl' % os.path.basename(sys.argv[0])
sys.exit(1)
UxlApp(filename=sys.argv[1]).run()