sugar-toolkit-gtk3/sugar/chat/sketchpad/Sketch.py
2006-05-19 12:45:08 -04:00

17 lines
284 B
Python

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()