this question is not repeated it is new one , do not delete it
this my code and also working But when i put it in a function it doesn't Works .
from PIL import ImageTk, Image
from validators.url import url
import os
import requests
from io import BytesIO
safe = tk.Tk()
link="https://i.ytimg.com/vi/QGzTCL1KkeY/hqdefault.jpg"
response = requests.get(link)
img_data = response.content
img = ImageTk.PhotoImage(Image.open(BytesIO(img_data)))
panel = tk.Label(safe, image=img,width=165,height=115)
panel.place(x=275,y=20)
safe.mainloop()
like this :
this will show me a photo from an URl link but it shows me nothin' ☟ ☟ ☟ ☟ ☟ ☟ ☟ ☟ ☟ ☟ ☟ ☟ ☟ ☟ ☟ ☟
import tkinter as tk
from PIL import ImageTk, Image
from validators.url import url
import os
import requests
from io import BytesIO
def thumbnail():
link='https://i.ytimg.com/vi/QGzTCL1KkeY/hqdefault.jpg'
response = requests.get(link)
img_data = response.content
img = ImageTk.PhotoImage(Image.open(BytesIO(img_data)))
panel = tk.Label(safe, image=img,width=165,height=115)
panel.place(x=275,y=20)
please give me the correct code it is really needed to me☞☜