""" Used in support of nks.py by K. Urner """ # from Dr. Zelle's graphics library from Tkinter import Tk from Tkinter import Canvas as TkCanvas class Canvas(object): def __init__(self, width, rows, pixelsize): self.pixelsize = pixelsize self.c = Tk() self.cv = TkCanvas(width=width*pixelsize, height=rows*pixelsize, background='black') self.cv.pack() def drawcell(self, thepoint): pixelsize=self.pixelsize therow = thepoint[0]*pixelsize thecol = thepoint[1]*pixelsize self.cv.create_rectangle(therow, thecol, therow+pixelsize, thecol+pixelsize, fill='yellow', outline='yellow') def showimage(self): self.c.mainloop() # comment this out if using IDLE with -n switch pass