def drawCandy(pen,row,col,candy): pen.penup() pen.goto(-170 + col * 40 , 170 - row * 40) if candy>=1 and candy<=6: image = "candy_" + str(candy) + ".gif" pen.getscreen().addshape(image) pen.shape(image) pen.stamp() def drawGrid(pen,grid): for row in range (0,len(grid)): for col in range (0,len(grid[row])): drawCandy(pen,row, col,grid[row][col]) pen.getscreen().update()