Пример #1
0
def main(options=None, args=None):

#    import ppm_dump
#    import png_canvas
    import canvas
    if options.ppm:
        canvas = canvas.ppm_canvas(371, 278)
        canvas.is_ascii = True
    else:
        canvas = canvas.png_canvas(371, 278)
    for wl in range(380, 751):
        r, g, b = wavelength_to_rgb(wl)
        for yy in range(0, 278):
            canvas.pixel(wl - 380, yy, r, g, b)
    sys.stdout.write(str(canvas))
Пример #2
0
def main(options=None, args=None):

    #    import ppm_dump
    #    import png_canvas
    import canvas
    if options.ppm:
        canvas = canvas.ppm_canvas(371, 278)
        canvas.is_ascii = True
    else:
        canvas = canvas.png_canvas(371, 278)
    for wl in range(380, 751):
        r, g, b = wavelength_to_rgb(wl)
        for yy in range(0, 278):
            canvas.pixel(wl - 380, yy, r, g, b)
    sys.stdout.write(str(canvas))
Пример #3
0
import canvas
import random
canvas = canvas.canvas(32, 24)
while True:
    canvas.draw()
    canvas.pixel(random.randrange(0, 32), random.randrange(0, 24), random.randrange(0, 3))