""" Used in support of nks.py by K. Urner """ # PIL stuff from PIL import Image, ImageDraw class Canvas(object): def __init__(self, width, rows, pixelsize): self.pixelsize = pixelsize self.im = Image.new('RGB',(width*pixelsize, rows*pixelsize),(0,0,0)) self.draw = ImageDraw.Draw(self.im) def drawcell(self, thepoint): therow = thepoint[0]*self.pixelsize thecol = thepoint[1]*self.pixelsize for i in range(self.pixelsize): for j in range(self.pixelsize): self.draw.point((therow + i, thecol + j), fill=(255,255,0)) def showimage(self): self.im.show()