3 # TinyPTC x11 v0.7.3 Python example
4 # Copyright (C) 2002 Alessandro Gatti <a.gatti@tiscali.it>
6 # http://www.sourceforge.net/projects/tinyptc/
8 # This library is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU Lesser General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or (at your
11 # option) any later version.
13 # This library is distributed in the hope that it will be useful, but WITHOUT
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 SIZE = (WIDTH * HEIGHT)
33 if not TinyPTC.ptc_open("Test", 320, 200):
34 raise Exception, "Can't open window!"
36 pixel = TinyPTC.pixel_array(SIZE)
39 for counter in range(SIZE):
46 seed = seed | (carry << 30)
48 pixel[counter] = (noise << 16) | (noise << 8) | noise
49 TinyPTC.ptc_update(pixel)