Hello i want to make a YouTube downloader in python using tkinter but there's an error
the code is:

```
from  tkinter import *
from tkinter import filedialog, ttk
from  pytube import YouTube
from tkinter.ttk import *
window = Tk()
window.geometry("500x500+350+100")

def openpath():
    download_out.config(text="من الطبيعي عدم استجابة الكمبيوتر عند التحميل")
    font = ("bahnschrift SewiBold", 10, "bold")
    download_name.config(text="")
    download_size.config(text="")
    download_loc.config(text="")
    global direct
    direct=filedialog.askdirectory()
    path_holder.config(text = direct)
def Download():
    url = link_ent.get()
    Selceted= types.get()
    if len(url) < 1:
        link_error.config(text = "الرجاء ادخال موقع الفيديو")
    if len(direct) < 1:
        path_error.config(text = "الرجاء ادخال مكان تنزيل الملف")
    else:
        link.config(text="")
        path_error.config(text="")
        try:
            Yt = YouTube(url)
            try:
                if Selceted == options[0]:
                    typ = Yt.streams.get_highest_resolution()
                elif Selceted == options[1]:
                    typ = Yt.streams.get_lowest_resolution()
                else:
                    Yt.streams.get_audio_only()
            except:
                path_error.config(text="حدثت معنا اخطاء")
        except:
                path_error.config(text="الرجاء ادخال مكان تنزيل صالح!")

window.title("Youtube Downloader")
window.resizable(False,False)
window.config(bg = "gray3")
heading = Label(window, text = "برنامج تحميل الفيديوهات", background = "gray3",foreground = "dark 
orange",
            font = ("bahnschrift SewiBold",20,"bold"))
 heading.pack(anchor="center",pady=10)
link = Label(window,text="الرابط",background="gray3",foreground="dark orange",
         font = ("bahnschrift SewiBold",10))
link.pack(anchor="ne",padx=30,pady=25)
entry_url=StringVar()
link_ent=Entry(window,width=52,textvariable = entry_url)
link_ent.place(x=90,y=83)

link_error= Label(window,background="gray3",foreground="dark orange",
         font = ("Bahnschrift SewiBold",10))
link_error.place(x=300,y=110)
path =  Label(window,text="موقع الملف",background="gray3",foreground="dark orange",
         font = ("bahnschrift SewiBold",10))
path.pack(anchor="ne",padx=30,pady=2)
path_holder= Label(window,text="\t\t\t",background="white",foreground="black",
         font = ("bahnschrift SewiBold",10))
path_holder.place(x=240,y=130)

path_style=ttk.Style()

path_style.configure("PT.TButton",background="DarkOrange1",foreground="DarkOrange1",
                 font = ("bahnschrift SewiBold",10))
path_btn = Button(window,width=11,text= "Selcet Path " ,style="PT.TButton",command= 
openpath())
path_btn.place(x=323,y=156)

path_error= Label(window,text="Demo",background="gray3",foreground="dark orange",
         font = ("Bahnschrift SewiBold",10))
path_error.place(x=280,y=150)
Download_type=Label(window,text="أنواع التنزيل",background="gray3",foreground="dark orange",
         font = ("Bahnschrift SewiBold",10))
Download_type.pack(anchor="e",padx=30,pady=37)
options=["جودة عالية","جودة منخفضة","صوت فقط"]
types = ttk.Combobox(window,values=options,width=23)
types.current(0)
types.place(x=240,y=185)
ChooseType=Label(window,text="اختر النوع ",background="gray3",foreground="dark orange",
         font = ("Bahnschrift SewiBold",10))
ChooseType.place(x=170,y=187)

download_style=ttk.Style()

download_style.configure("DD.TButton",background="DarkOrange1",foreground="DarkOrange1",
                 font = ("bahnschrift SewiBold",10))

Download_btn = Button(window,width=11,text= "تحميل " ,style="PT.TButton")
Download_btn.pack(anchor="center",pady=30)

download_out=Label(window,text="طبيغي ان تظهر رسالة اللابتوب غير مستجيب أثناء 
التحميل",background="gray3",foreground="dark orange",
             font = ("Bahnschrift SewiBold",10))
download_out.pack(anchor="center",pady=30)

download_name=Label(window,background="gray3",foreground="dark orange",
         font = ("Bahnschrift SewiBold",10))
download_name.pack(anchor="ne",padx=30,pady=10)

download_size=Label(window,background="gray3",foreground="dark orange",
         font = ("Bahnschrift SewiBold",10))
download_size.pack(anchor="ne",padx=30,pady=10)

download_loc=Label(window,background="gray3",foreground="dark orange",
         font = ("Bahnschrift SewiBold",10))
download_loc.pack(anchor="ne",padx=30,pady=10)

window.mainloop()

```

and error is:

```none
Traceback (most recent call last):
  File "C:\Users\baraa\PycharmProjects\pythonProject1\folder\baraa.py", line 72, in <module>
    path_btn = Button(window,width=11,text= "Selcet Path " ,style="PT.TButton",command= openpath())
  File "C:\Users\baraa\PycharmProjects\pythonProject1\folder\baraa.py", line 10, in openpath
    download_out.config(text="من الطبيعي عدم استجابة الكمبيوتر عند التحميل")
NameError: name 'download_out' is not defined`

```
['https://Stackoverflow.com/questions/68698392', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16312753/']
Using wrong value for option `command` in a `Button`, it should be a function name to call when button click, not result of a function.

In your code, function will be called when button defined befor variable `download_out` defined.

```py
#path_btn = Button(window,width=11,text= "Selcet Path " ,style="PT.TButton",command=openpath())
path_btn  = Button(window,width=11,text= "Selcet Path " ,style="PT.TButton",command=openpath)

```
since download\_out was declared as global variable you should use the reserved word `global` in order to use it from within the function `openpath`

```
global download_out
download_out.config(text="من الطبيعي عدم استجابة الكمبيوتر عند التحميل")

```