""" #..d >>> from color_patch import * >>> """ import image, pprint def color_patch(pixel, width, height): """Returns an image matrix of the indicated width and height in which all pixels are of the same color, indicated by the given rgb pixel. >>> m = color_patch((0, 255, 0), 2, 3) >>> pprint.pprint(m) [[(0, 255, 0), (0, 255, 0)], [(0, 255, 0), (0, 255, 0)], [(0, 255, 0), (0, 255, 0)]] >>> """ matrix = [] for y in range(height): row = [] for x in range(width): row.append(pixel) matrix.append(row) return matrix def main(): dark_blue = (0, 0, 100) m = color_patch(dark_blue, 200, 100) im = image.new(m) im.show() if __name__ == '__main__': main()