Reputation: 119
Good morning, everyone, I tried to import image logo.gif but got an error message saying the image does not exit. Appreciate your help. Dennis
from PIL import Image, ImageChops
from PIL.GifImagePlugin import getheader, getdata
img = Image.open("logo.gif")
img.show()
from tkinter import *
window = Tk()
imgLbl = Label( window, image = img )
TclError: image "<PIL.GifImagePlugin.GifImageFile image mode=P size=92x95 at 0x8C92B38>" doesn't exist
Upvotes: 0
Views: 3217
Reputation: 1
import fastgif import matplotlib.pyplot as plt import numpy as np
def get_fig(idx): x_space = np.linspace(0, 10, 30) + (idx / 20)
fig, ax = plt.subplots(dpi=150)
ax.plot(x_space, np.sin(x_space))
ax.grid()
ax.set_ylim(-1.2, 1.2)
ax.set_xlabel('x')
ax.set_ylabel('sin(x)')
fig.suptitle(f'Sine wave gif')
return fig
Upvotes: 0
Reputation: 88
Please refer to this post Play Animations in GIF with Tkinter
This question seems to be a duplicate. You'll have to first convert the image to tK compatible image by the function PhotoImage present in ImageTk class.
Upvotes: 0