Mercurial > code > home > repos > light9
annotate lib/goocanvas_compat.py @ 1454:50fe80faebab
animRainbow test. KC faster frame rate
Ignore-this: 419c6a70711ba3df9a234998760f8d9c
author | drewp@bigasterisk.com |
---|---|
date | Sun, 12 Jun 2016 00:26:12 +0000 |
parents | 2d2be076754f |
children |
rev | line source |
---|---|
1058
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
1 from gi.repository import GooCanvas |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
2 |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
3 def Points(pts): |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
4 cp = GooCanvas.CanvasPoints.new(len(pts)) |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
5 for i, (x, y) in enumerate(pts): |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
6 cp.set_point(i, x, y) |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
7 return cp |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
8 |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
9 def polyline_new_line(parent, x0=None, y0=None, x1=None, y1=None, points=None, **props): |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
10 p = GooCanvas.CanvasPolyline() |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
11 p.set_property('parent', parent) |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
12 if x0 is not None or points is not None: |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
13 pts = points or Points([(x0, y0), (x1, y1)]) |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
14 p.set_property('points', pts) |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
15 for k, v in props.items(): |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
16 p.set_property(k, v) |
2d2be076754f
forgot to add goocanvas code
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
17 return p |