def spins_plot(grid): #spin sectangles for x, y in grid: if grid.GetCell(x, y) == -1: col = 'red' else: col = '#28F' c.create_rectangle(51 + x * a, 51 + y * a, 51 + (x + 1) * a, 51 + (y + 1) * a, fill=col, outline=col, width=0) def latt(g): #redraw of the screen c.delete(ALL) spins_plot(g) grid() c.update() if __name__ == '__main__': x = 50 y = 50 g = Field(x, y) g.FlipSpin(2, 1) init(x, y) latt(g)