1
from random import random
2
from kivy.app import App
3
from kivy.uix.widget import Widget
4
from kivy.graphics import Color, Ellipse, Line
7
class MyPaintWidget(Widget):
9
def on_touch_down(self, touch):
10
color = (random(), random(), random())
14
Ellipse(pos=(touch.x - d / 2, touch.y - d / 2), size=(d, d))
15
touch.ud['line'] = Line(points=(touch.x, touch.y))
17
def on_touch_move(self, touch):
18
touch.ud['line'].points += [touch.x, touch.y]
21
class MyPaintApp(App):
24
return MyPaintWidget()
27
if __name__ == '__main__':