imagelist=[]
with open("imagelink.txt") as url:
for url2 in url:
if url2.strip():
raw_data= urllib.request.urlopen(url2.strip()).read()
im = ImageTk.PhotoImage(data=raw_data)
result = maintext.image_create(0.0, image=im)
imagelist.append(im) # save a reference of the image
编辑
好的,所以我完全复制/遵循了代码,但是当我运行时,在文本小部件中看不到图像,只有白色屏幕可见