Skip to content

Instantly share code, notes, and snippets.

@tshirtman
Last active February 3, 2020 18:03
Show Gist options
  • Save tshirtman/0d6d446cb1ee4c395504a9154e393378 to your computer and use it in GitHub Desktop.
Save tshirtman/0d6d446cb1ee4c395504a9154e393378 to your computer and use it in GitHub Desktop.
from kivy.app import App
from kivy.lang import Builder
from kivy.factory import Factory
KV = '''
FloatLayout:
Scatter:
id: scatter
size_hint: None, None
auto_bring_to_front: False
Widget:
id: widget
point: 20, 20
canvas:
Color:
Line:
rectangle: [0, 0] + self.size
Rectangle:
pos: self.point
size: 10, 10
Widget:
canvas:
Color:
rgba: 1, 0, 0, 1
Line:
width: 2
rectangle:
(
scatter.pos,
scatter.size,
scatter.scale,
) and (
self.to_widget(*widget.to_window(*widget.point))
+ (10, 10)
)
'''
class Application(App):
def build(self):
return Builder.load_string(KV)
if __name__ == "__main__":
Application().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment