Skip to content

Instantly share code, notes, and snippets.

@tshirtman
Created May 3, 2012 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tshirtman/2590079 to your computer and use it in GitHub Desktop.
Save tshirtman/2590079 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty
from kivy.graphics import Color, Line
class ArrowPointer(Widget):
arrow_tip = ObjectProperty(None)
def __init__(self, **kwargs):
super(ArrowPointer, self).__init__(**kwargs)
with self.canvas.after:
Color (0, 0, 111)
self.arrow_tip = Line()
self.bind(pos=self._update_arrow_points)
self._update_arrow_points(self, self.pos)
def _update_arrow_points(self, object, pos):
offset = 50
x,y = pos
self.arrow_tip.points = (x - offset, y - offset, x + offset, y + offset)
print self.arrow_tip
class TestB(App):
def build(self):
return ArrowPointer()
if __name__ == '__main__':
TestB().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment