
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 tkinterfrom tkinter import *# importing YouTube modulefrom pytube import YouTube# initializing tkinterroot = Tk()# setting the geometry of the GUIroot.geometry("400x350")# setting the title of the GUIroot.title("Youtube video downloader application")# defining download functiondef download():# using try and except to execute program without errorstry: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 userLabel(root, text="Welcome to youtube\nDownloader Application", font="Consolas 15 bold").pack()# declaring StringVar type variablemyVar = StringVar()# setting the default text to myVarmyVar.set("Enter the link below")# created the Entry widget to ask user to enter the urlEntry(root, textvariable=myVar, width=40).pack(pady=10)# declaring StringVar type variablelink = StringVar()# created the Entry widget to get the linkEntry(root, textvariable=link, width=40).pack(pady=10)# created and called the download function to download videoButton(root, text="Download video", command=download).pack()# running the mainlooproot.mainloop()
Output

Also read:
- Struggling to Generate Ghibli-Style AI Images? Here’s the Real Working Tool That Others Won’t Tell You About!In recent weeks, the digital art community has been captivated by a burgeoning trend: the creation of Studio Ghibli-style images using artificial intelligence (AI). This movement has not only showcased the evolving capabilities of AI in art generation but has also sparked discussions on creativity, ethics, and the future of digital artistry. The Rise of…
- ChatGPT vs DeepSeek: Who is the winner?Here’s a detailed comparison between ChatGPT (specifically GPT-4o) and DeepSeek-V3 based on various online resources, focusing on key metrics such as time to build, cost, performance, and other relevant factors: 1. Architecture and Model Size 2. Training Cost and Efficiency 3. Performance Benchmarks 4. Cost of Usage 5. Open-Source and Accessibility 6. Real-World Applications 7….
- People are becoming AI Engineer with this free course in 2025: Here is how to join this…Artificial Intelligence (AI) has become a cornerstone of technological advancement, shaping industries and transforming careers. If you’ve been looking to upskill or dive into the fascinating world of AI, freeCodeCamp.org has released an incredible resource: the AI Foundations Course on YouTube. This 11-hour video, created by @LunarTech_ai, is not just another crash course – it’s…
- Apply to Google’s Student Training in Engineering Program (STEP) Intern, 2025Google’s Student Training in Engineering Program (STEP) Intern, 2025, is a fantastic opportunity for students passionate about programming and software development. Designed to support skill-building and career growth, this program offers a chance to work with one of the world’s leading tech companies. Here’s everything you need to know about this internship opportunity. What Is…
- Self-Driving Car Saves Falling Pedestrian, Showcases Promise of Autonomous TechnologyIn a dramatic demonstration of the potential for self-driving technology to enhance road safety, a Waymo’s autonomous vehicle recently avoided a serious accident when a scooter rider, startled by a pothole, lost balance and fell onto the road. The incident, captured on video, highlights the advanced capabilities of modern driverless technology. As the rider tumbled…