Python Flask: getting an error when server shutdown is declined

Solution
def dialog_yn(title="mesage Box", prompt="Make your choice"):
    root = Tk()
    root.withdraw()
    result = messagebox.askquestion(title=title, message=prompt, icon='warning')
    root.destroy()
    return result