Skip to content

Instantly share code, notes, and snippets.

@tshirtman
Last active January 3, 2020 16:48
Show Gist options
  • Save tshirtman/43baf0f202bfcbfc6313f2d7ef66ed9e to your computer and use it in GitHub Desktop.
Save tshirtman/43baf0f202bfcbfc6313f2d7ef66ed9e 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 = '''
Widget:
Scatter:
id: scatter
size: img.size
AsyncImage:
id: img
source: 'https://placekitten.com/g/200/300'
size_hint: None, None
size: self.texture_size
Widget:
on_touch_down:
if args[1].is_double_tap: print("double tap")
canvas:
Color:
rgba: 1, 0, 0, 1
Line:
rectangle: list(scatter.pos) + list(scatter.size)
Color:
rgba: 1, 1, 0, 1
Line:
rectangle: list(scatter.pos) + list(scatter.bbox)
'''
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