Skip to content

Instantly share code, notes, and snippets.

@mike-perdide
Created November 20, 2012 19:48
Show Gist options
  • Select an option

  • Save mike-perdide/4120560 to your computer and use it in GitHub Desktop.

Select an option

Save mike-perdide/4120560 to your computer and use it in GitHub Desktop.
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.floatlayout import FloatLayout
Builder.load_string("""
<TestWidget>
label: label
Label:
id: label
size_hint: .1, .1
pos_hint: {"x": .5, "y": .5}
canvas.before:
Color:
rgb: .4, .1, .5
Rectangle:
size: self.size
pos: self.pos
Color:
rgb: .1, .8, .4
Line:
circle: (self.center_x, self.center_y, min(self.width, self.height) / 2)
""")
class TestWidget(FloatLayout):
def __init__(self):
FloatLayout.__init__(self)
self.label.bind(on_touch_down=self.label_down)
def label_down(self, btn, event):
print "Label down !"
class TestApp(App):
def build(self):
widget = TestWidget()
return widget
if __name__ == "__main__":
TestApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment