mirror of https://github.com/kivy/kivy.git
uxl: add uxllauncher example + button example
This commit is contained in:
parent
c996b7e8e2
commit
596c5bec5e
|
@ -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
|
|
@ -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()
|
Loading…
Reference in New Issue