Python 3.3 Tkinter Image Doesn't Exist
I am trying to open an image with ImageTk.PhotoImage from PIL but I keep hitting the same error. I have the image and can see that it is there when it downloads it, it opens it, bu
Solution 1:
I was attempting to apply the image to the text attribute of the label instaed of the image. Here is the fixed code.
url = self.threadLinkList[self.y]+'.gif'
imageName=self.threadLinkList[self.y][-11:-4]+'.gif'
print(imageName)
urllib.request.urlretrieve(self.threadLinkList[self.y],imageName)
imgfile = Image.open(imageName)
imgfile = imgfile.resize((150,150),Image.ANTIALIAS)
# img = Image.open(file)
print(imgfile)
self.threadImage = ImageTk.PhotoImage(imgfile)
self.threadLabelImage.config(***image*** = self.threadImage)
self.threadImage.image = imgfile
Post a Comment for "Python 3.3 Tkinter Image Doesn't Exist"