1+ # ================================= Importing Suitable Libraries =========================================================
12import tkinter as tk
23from tkinter import *
34from PIL import ImageTk , Image
45from tkinter import messagebox
6+ #install through ->> pip install pytube3
57import pytube
68import time
79
10+ # ===================================== End ===============================================================
11+
12+ #===================================== Adding Window Components =============================================
13+ #craeting main window
814root = tk .Tk ()
15+ #window title
916root .title ("Youtube Downloader" )
17+ #window logo
1018root .iconbitmap ("Youtube.ico" )
19+ #window size
1120root .geometry ("700x300" )
12- #root.maxsize(700,250)
21+ #window max-size
22+ root .maxsize (700 ,250 )
23+ #window min-size
1324root .minsize (700 ,300 )
1425
26+ # ================================ End =============================================================================
1527
28+ #=================================== function code starts here ======================================================
1629def download ():
1730 link = text .get ("1.0" ,"end-1c" )
1831
@@ -28,31 +41,37 @@ def download():
2841 stream .download ()
2942 messagebox .showinfo ("YouTube Downloader" ,'Video has been download successfully' )
3043
31-
44+ # ================================================= End =========================================================
3245
33-
34-
46+ # ================================================ main design code =================================================
47+ # header label
3548header = Label (root ,bg = "black" ,width = "300" ,height = "2" )
3649header .place (x = 0 ,y = 0 )
3750
51+ #youtube logo image
3852yt_logo = ImageTk .PhotoImage (Image .open ('youtube.png' ))
3953logo = Label (root , image = yt_logo ,borderwidth = 0 )
4054logo .place (x = 10 ,y = 10 )
4155
56+ #caption label
4257caption = Label (root ,text = "YouTube Downloader" ,font = ('verdana' ,10 ,'bold' ))
4358caption .place (x = 50 ,y = 10 )
4459
45-
46-
60+ #youtube logo image
4761yt1_logo = ImageTk .PhotoImage (Image .open ('yt.png' ))
4862logo1 = Label (root , image = yt1_logo ,borderwidth = 0 )
4963logo1 .place (x = 300 ,y = 60 )
5064
51-
65+ #text widgets to get the url
5266text = Text (root ,width = 60 ,height = 2 ,font = ('verdana' ,10 ,'bold' ))
5367text .place (x = 90 ,y = 180 )
5468text .insert ('end' ,'Paste your video link here' )
5569
70+ #Download Buttons
5671button = Button (root ,text = "Download" ,relief = RIDGE ,font = ('verdana' ,10 ,'bold' ),bg = "red" ,fg = "white" ,command = download )
5772button .place (x = 330 ,y = 220 )
58- root .mainloop ()
73+
74+ #load the window
75+ root .mainloop ()
76+
77+ #======================================================== End ========================================================
0 commit comments