I replace the extracted part of the image with the following code
response = requests.get(url)
img = Image.open(io.BytesIO(response.content))
img.save("picture/%s.png" % row)
self.foto = PhotoImage(file="picture/%s.png" % row)
Label(self.frame, image=self.foto, name=str(row)).grid(row=row, column=0, sticky=W)
Now there is no error when opening the image or something else, now I get another problem with the following code:
def populate(self):
http = httppoolmgr()
array = xmltohash(getrack(http,'618cd2a4a2a1740a9f46e4f367ef88f3'))
for row in range(len(array)):
url = str((array[row]),"utf-8").split("$#$")[3]
title = str((array[row]),"utf-8").split("$#$")[1]
response = requests.get(url)
img = Image.open(io.BytesIO(response.content))
img.save("picture/%s.png" % row)
self.foto = PhotoImage(file="picture/%s.png" % row)
Label(self.frame, image=self.foto, name=str(row)).grid(row=row, column=0, sticky=W)
t=str((array[row]),"utf-8").split("$#$")[1]
Label(self.frame, text=t).grid(row=row, column=1, sticky=W)
Only the last image is displayed, but all text is displayed correctly in the frame. If anyone can help, I'm a little stuck.
Hi,
Jros
source
share