I'm learning tkinter and I decided to make a small youtube-dl GUI as a project. This is my code so far.
from Tkinter import *
import youtube_dl
root = Tk()
myLabel = Label(root, text="YOUTUBE-DL MUSIC").grid(column=1, row=1)
linkput = Entry(root, width=50)
linkput.grid(column=1, row=2)
def downloadsong():
linkval = linkput.get()
params = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
'source_address': '0.0.0.0',}
youtube = youtube_dl.YoutubeDL(params)
youtube.download([linkval])
outputtext = Label(root, text="Downloaded")
outputtext.grid(column=1, row=3)
downloadbutton = Button(root, text="Download", padx=50, command=downloadsong).grid(column=2, row=2)
root.mainloop()
So, I'm using the python module of youtube-dl to download the link of whatever is in the entry box. The GUI works so far, but I want to print the terminal output as a label. I can see in the terminal, ex.
Video: "Learn Tkinter!" Download: 80%
Is it possible to have this terminal output put into a tkinter label? I could try using subprocess.check_output() but I'd prefer using the python module instead of the CLI. Also, since the terminal output changes (the percent progress), I'm not sure if that would work in a label.