函数在终端上加载,而不是在加载 tkinter GUI 之后加载

Function Loads on terminal instead of after loading tkinter GUI

enter code here
    def validator ():

    if desAddress.get()=='' and sourceAddress.get()=='' :
        messagebox.showwarning('Validator','Please enter the source address \n Enter destination address')
    elif sourceAddress.get()=='':
         messagebox.showwarning('Validator','Please enter the source address')
    elif desAddress.get()=='':
         messagebox.showwarning('Validator','Please enter the destination address')
    def exe():
 os.system('python class_runner.py')
 funVariable=lambda:validator(),exe()

enter code here

上面的代码让我很头疼。我的 funVariable 在终端上加载而不是在单击阻止我的 tkinter window 加载的按钮后加载。

已解决。代码的问题是我在顶部导入了 .py 文件,这阻止了代码 运行。已解决。