Skip to content

Instantly share code, notes, and snippets.

@Kovak
Created June 15, 2013 04:18
Show Gist options
  • Save Kovak/5786878 to your computer and use it in GitHub Desktop.
Save Kovak/5786878 to your computer and use it in GitHub Desktop.
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.label import Label
class RootWidget(Widget):
pass
class Robot(Widget):
def on_pos(self, instance, value):
print 'robot_pos: ', value
class CustomLabel(Label):
def on_pos(self, instance, value):
print 'label_pos: ', value
class TestApp(App):
def build(self):
pass
if __name__ == '__main__':
TestApp().run()
RootWidget:
<RootWidget>:
Robot:
<Robot>:
pos: (250,250)
size: (40,40)
label_robot: robot_label
canvas:
Color:
rgb: (1,0,0)
Rectangle:
size: self.size
pos: self.pos
on_pos:
print self.pos
CustomLabel:
id: robot_label
font_size: 25
text: "B"
color: (0, 1, 0, 1)
pos: root.pos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment