from kivy.app import App
from kivy.uix.widget import Widget
from kivy.graphics import Color, Ellipse , Line
from random import random
class MyPaintWidget(Widget):
def on_touch_down(self,touch):
color = (random(),random(),random())
with self.canvas:
Color(*color)
self.pck(color)
print '-'*20
self.pck(*color)
d = 30
Ellipse(pos=(touch.x - d /2 , touch.y - d/2) , size = (d,d))
touch.ud['line'] = Line(points=(touch.x , touch.y))
print touch.ud
def pck(self, a =255,b = 255,c = 255):
print "a = " + str(a)
print "b = " + str(b)
print "c = " + str(c)
def on_touch_move(self,touch):
with self.canvas:
touch.ud['line'].points += [touch.x, touch.y]
print touch.ud['line'].points
class MyPaintApp(App):
def build(self):
return MyPaintWidget()
if __name__ == '__main__':
MyPaintApp().run()
댓글 없음:
댓글 쓰기