import tkinter as tk, time root = tk.Tk() Frame_Width = 800 Frame_Height = 300 root.geometry(f'{Frame_Width}x{Frame_Height}') canvas = tk.Canvas(root) canvas.pack() canvas.config(width = Frame_Width, height = Frame_Height) root.title("Checkerboard") SIZE = 20 color = "black" move = 0 while True: canvas.delete("all") move += 60 for y in range(8): if (y%2 == 0): color = "black" else: color = "white" for x in range(8): x1 = x*SIZE + move y1 = y*SIZE + 50 x2 = x1 + SIZE y2 = y1 + SIZE canvas.create_rectangle([x1,y1,x2,y2], fill = color) if(color == "black"): color = "white" else: color = "black" time.sleep(0.01) canvas.update() if x2 > Frame_Width: move = 0 canvas.update() time.sleep(20) root.destroy()