from kivy.app import App
from kivy.uix.widget import Widget
from kivy.graphics import Color, Ellipse, Rectangle, Line
class MyPaintWidget(Widget):
a=[[1,1]]
def on_touch_down(self, touch):
with self.canvas:
self.a.append([touch.x,touch.y])
print(self.a)
L = len(self.a)
x1 = self.a[L-1][0]
y1 = self.a[L-1][1]
x2 = self.a[L-2][0]
y2 = self.a[L-2][1]
Color(0.5, 0.5, 1)
d = 50
if (L>2) :
Line(points=(x1,y1,x2,y2), width=10)
Ellipse(pos=(touch.x+12,touch.y+13),size=(20,20))
class MyPaintApp(App):
def build(self):
return MyPaintWidget()
if __name__ == '__main__':
MyPaintApp().run()
No hay comentarios:
Publicar un comentario