From 596c5bec5e436f16ed1c31d01e12777ae744c184 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Thu, 4 Nov 2010 22:36:19 -0400 Subject: [PATCH] uxl: add uxllauncher example + button example --- examples/uxl/button.uxl | 21 +++++++++++++++++++++ examples/uxl/uxlrun.py | 19 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 examples/uxl/button.uxl create mode 100644 examples/uxl/uxlrun.py diff --git a/examples/uxl/button.uxl b/examples/uxl/button.uxl new file mode 100644 index 000000000..b1c50c856 --- /dev/null +++ b/examples/uxl/button.uxl @@ -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 diff --git a/examples/uxl/uxlrun.py b/examples/uxl/uxlrun.py new file mode 100644 index 000000000..1a9a5d4d6 --- /dev/null +++ b/examples/uxl/uxlrun.py @@ -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()