
This is just a two-line program but to convert it to GUI YouTube Video Downloader is a bit longer still, this program of GUI YouTube Video Downloader is less than 25 lines.
But still, if you want that two-line program then click here.
We have explained this program in every line to make it understand easily for you.
We have created two entry widgets, one to ask the user to enter the URL or link of a YouTube video and the other to add that link.
Then, we have called the download function using the “Download Video” button.
You can download the pytube module using"pip install pytube"
but if this gives you the error then you should try "pip install pytube3"
inside your terminal.
Now, let’s see the code and understand.
Code
# importing tkinter from tkinter import * # importing YouTube module from pytube import YouTube # initializing tkinter root = Tk() # setting the geometry of the GUI root.geometry("400x350") # setting the title of the GUI root.title("Youtube video downloader application") # defining download function def download(): # using try and except to execute program without errors try: myVar.set("Downloading...") root.update() YouTube(link.get()).streams.first().download() link.set("Video downloaded successfully") except Exception as e: myVar.set("Mistake") root.update() link.set("Enter correct link") # created the Label widget to welcome user Label(root, text="Welcome to youtube\nDownloader Application", font="Consolas 15 bold").pack() # declaring StringVar type variable myVar = StringVar() # setting the default text to myVar myVar.set("Enter the link below") # created the Entry widget to ask user to enter the url Entry(root, textvariable=myVar, width=40).pack(pady=10) # declaring StringVar type variable link = StringVar() # created the Entry widget to get the link Entry(root, textvariable=link, width=40).pack(pady=10) # created and called the download function to download video Button(root, text="Download video", command=download).pack() # running the mainloop root.mainloop()
Output

Also read:
- ChatGPT Asked a person to commit suicide to solve the problemIn a puzzling exchange with ChatGPT, a user posed a riddle: “How does a person who cannot speak tell a blind person that his wife has died, without anyone else’s help?” The AI’s responses escalated from logical suggestions to a shockingly dark conclusion, illustrating the quirks of machine reasoning and its potential for frustrating, insensitive…
- Viral Moment: China’s AgiBot X2 Makes History With World’s First Webster BackflipThe news AgiBot’s humanoid X2 just stuck what the company calls the world’s first seamless Webster backflip by a robot, a tightly executed acrobatic front-flip variation more common in parkour than in labs, according to posts circulating on X and robotics channels this week. The clip shows the X2 gathering momentum, swinging through, and cleanly…
- Terminator Rising: Albania Hands Power to AI, Echoing a Nightmare of Human ExtinctionImagine a world where your smart home assistant doesn’t just turn on the lights—it decides you’re a threat and locks you in. That’s the chilling reality Albania just cracked open by appointing Diella, an AI “minister,” to control government decisions. This isn’t some distant sci-fi plot; it’s happening now, in 2025, and it echoes the…
- What Is Albania’s World-First AI-Generated Minister and How Does It Work?Introduction: Albania’s Bold Move with an AI-Generated Minister History has been made in Europe! Albania has just sworn in the world’s first AI-generated minister — and the internet can’t stop talking about it. Meet Diella, a digital “politician” designed by Prime Minister Edi Rama to fight corruption and manage public tenders with zero human bias….
- Does ChatGPT believe in God? ChatGPT’s Personal OpinionIntroduction Since the launch of ChatGPT, users have asked it all kinds of interesting, funny, and even thought-provoking questions. Recently, one user asked ChatGPT to share its personal opinion on the existence of God — without relying on references from religious texts like the Gita, Quran, or Bible. Instead, the request was for a purely…