Python 如何在tkinter中添加延迟

Python 如何在tkinter中添加延迟,python,tkinter,Python,Tkinter,我试图在我的项目中使用时间添加一些延迟时间。sleep在def pin\u popup\u success(self):但它使我的程序冻结,无法运行授予的访问权限。如何使程序出现访问权限授予约3秒 代码 谢谢 它延迟3秒,然后转到主窗口功能 def check_pin(self): if(self.input_code.get()!="1"): self.pin_popup_fail() else: self.pin_popup

我试图在我的项目中使用
时间添加一些延迟时间。sleep
def pin\u popup\u success(self):
但它使我的程序冻结,无法运行
授予的访问权限。如何使程序出现
访问权限授予
约3秒

代码

谢谢

它延迟3秒,然后转到主窗口功能

def check_pin(self):
    if(self.input_code.get()!="1"):
        self.pin_popup_fail()
    else:
        self.pin_popup_success()

def pin_popup_fail(self):
    self.pinlabel.config(text="WRONG PIN")

def pin_popup_success(self):
    self.pinlabel.config(text="ACCESS GRANTED")
    self.returnToIdle_fromPin()
    time.sleep(3)
    
def returnToIdle_fromPin(self):
    self.pinFrame.pack_forget()
    self.show_idle()
splash_root = Tk()
splash_root.after(3000,main_window)