Skip to content

Instantly share code, notes, and snippets.

@kived
Created July 2, 2015 16:13
Show Gist options
  • Save kived/b5c8cfe7895a9d6a9e05 to your computer and use it in GitHub Desktop.
Save kived/b5c8cfe7895a9d6a9e05 to your computer and use it in GitHub Desktop.
Kivy: referencing ids in canvas
FloatLayout:
Widget:
canvas:
Color:
rgba: 1, 0, 0, 1
Line:
points: [btn.center_x, btn.center_y, 500, 500] # NameError: name 'btn' is not defined
Button:
id: btn
size_hint: .3, .3
FloatLayout:
Button:
id: btn
size_hint: .3, .3
Widget:
canvas:
Color:
rgba: 1, 0, 0, 1
Line:
points: [btn.center_x, btn.center_y, 500, 500] # works just fine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment