Mercurial > code > home > repos > light9
comparison lib/goocanvas_compat.py @ 1058:2d2be076754f
forgot to add goocanvas code
Ignore-this: 6b9f96d08ecea4c47c5f91dab124f04
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Mon, 02 Jun 2014 00:10:33 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1057:2448ebc38a6f | 1058:2d2be076754f |
---|---|
1 from gi.repository import GooCanvas | |
2 | |
3 def Points(pts): | |
4 cp = GooCanvas.CanvasPoints.new(len(pts)) | |
5 for i, (x, y) in enumerate(pts): | |
6 cp.set_point(i, x, y) | |
7 return cp | |
8 | |
9 def polyline_new_line(parent, x0=None, y0=None, x1=None, y1=None, points=None, **props): | |
10 p = GooCanvas.CanvasPolyline() | |
11 p.set_property('parent', parent) | |
12 if x0 is not None or points is not None: | |
13 pts = points or Points([(x0, y0), (x1, y1)]) | |
14 p.set_property('points', pts) | |
15 for k, v in props.items(): | |
16 p.set_property(k, v) | |
17 return p |