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))
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))