pysoy
view examples/ColorCanvas.py @ 1633:0b9bcf356f2b
Cleaned up PYSOY_VERSION macro setting.
| author | Arc Riley <arcriley@gmail.com> |
|---|---|
| date | Fri, 13 May 2011 01:58:09 -0400 |
| parents | 5fcf69d73564 |
| children | cbd26822fa71 |
line source
1 #!/usr/bin/env python3
3 from random import randint, random
4 from time import sleep
5 import soy
6 win = soy.widgets.Window()
7 tex = soy.textures.Texture()
8 tex.size = soy.atoms.Size((16,16))
9 tex.smooth = False
10 can = soy.widgets.Canvas(win, tex)
12 colors = (
13 soy.atoms.Color('blue'),
14 soy.atoms.Color('cyan'),
15 soy.atoms.Color('green'),
16 soy.atoms.Color('white'),
17 soy.atoms.Color('yellow'),
18 soy.atoms.Color('red'),
19 soy.atoms.Color('pink'),
20 soy.atoms.Color('grey')
21 )
23 for i in range(256):
24 tex[i] = colors[randint(0,len(colors)-1)]
26 while True:
27 colors[randint(0,len(colors)-1)].red += random()*2+1
28 colors[randint(0,len(colors)-1)].green += random()*2+1
29 colors[randint(0,len(colors)-1)].blue += random()*2+1
30 tex[randint(0,255)] = colors[randint(0,len(colors)-1)]
31 sleep(.1)
