Source

PyCessing / pycessing / data / examples / wrapping-paper-squares.cess

#this generates a pretty pantone-looking grid of colored squares
#slowly changing color and value
#
# I once used it to create wrapping paper for gifts.  It was quicker
# and cooler than going to the store.  -Brendan

width = 1024
height = 768
steps = 10

step = width / steps

x = 0
y = 0

r = 50

def setup():
    pycessing.noLoop = True
    pycessing.size(width, height)
    setFillState(True)
    setStrokeWidth(0)
    
def draw():
    global x, y
    setBackground(255,255,255)
    while(y < height):
        while(x < width):
            red = (x * 255) / width
            green = (y * 255) / height
            setFillColor(red, green, 128)
            print "x: " + str(x) + " y: " + str(y)
            rect(x, y, r*2, r*2)
            x += step
        x = 0
        y += step
        print "stepped - x: " + str(x) + " y: " + str(y)
    print "done"
    #screenGrab("wrappingpaper-sq.jpg")