Mar-20-2023, 01:56 PM
Thumbnail picture won't show, and also no error. why?
this is my full code.
this is my full code.
from tkinter import * from PIL import Image, ImageTk import pytube as py import requests from io import BytesIO root = Tk() root.title('Youtube downloader') root.geometry('700x500') Label(root, text='Welcome to Rag-Chi',font=('Times New Roman',40)).place(anchor=CENTER, x= 350,y=50) Label(root, text='Link: ',font=('Times',21)).place(x=260, y=147, anchor=E) def show_info(): video_url = link.get() youtube = py.YouTube(video_url) video_title = youtube.title video_thumbnail_url = youtube.thumbnail_url response = requests.get(video_thumbnail_url) img_data = response.content img = Image.open(BytesIO(img_data)) resized = img.resize((50,50),Image.LANCZOS) photo = ImageTk.PhotoImage(resized) Title.config(text=video_title) thumbnail.config(image=photo) link = StringVar() url_entry = Entry(root, textvariable=link).place(x=350,y=150, anchor=CENTER) Title = Label(root) Title.place(x= 200,y=400) thumbnail = Label(root,) thumbnail.place(x=700,y=700, anchor=NW) Button(root, text='Get Info',command=show_info).place(x=300,y=200, anchor=CENTER) Button(root, text='Download').place(x=400,y=200, anchor=CENTER) root.mainloop()it displays the title. but thumbnail is not showing.