INNER CODE UNIT · Python

close

tuangauss/DataScienceProjects · Python/fireworks.py:131

def close(*ignore):
    """Stops simulation loop and closes the window."""
    global root
    root.quit()
    
if __name__ == '__main__':
    root = tk.Tk()
    cv = tk.Canvas(root, height=600, width=600)
    # use a nice background image
    image = Image.open("image.jpg")
    photo = ImageTk.PhotoImage(image)
    cv.create_image(0, 0, image=photo, anchor='nw')

    cv.pack()
    root.protocol("WM_DELETE_WINDOW", close)

    root.after(100, simulate, cv)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…