import tkinter as tk
from tkinter import PhotoImage
# Create the main application window
root = tk.Tk()
root.title("GIF Viewer")
# Set the size of the window (optional)
root.geometry("500x500")
# Load the GIF
try:
gif = PhotoImage(file="your_gif_file.gif")
# If the GIF is larger than the window, resize the window to fit the GIF
if gif.width() > 500 or gif.height() > 500:
root.geometry(f"{gif.width()}x{gif.height()}")
except Exception as e:
tk.Label(root, text=f"Error loading GIF: {e}", fg="red").pack()
root.mainloop()
exit()
# Display the GIF in a label
gif_label = tk.Label(root, image=gif)
gif_label.pack(expand=True)
# Run the Tkinter main loop
root.mainloop()