sugar-toolkit-gtk3/sugar/chat/sketchpad/Sketch.py

17 lines
284 B
Python
Raw Normal View History

2006-05-19 18:45:08 +02:00
class Sketch:
def __init__(self):
self._points = []
def add_point(self, x, y):
self._points.append([x, y])
def draw(self, ctx):
start = True
for [x, y] in self._points:
if start:
ctx.move_to(x, y)
start = False
else:
ctx.line_to(x, y)
ctx.stroke()