在 Python 3.4 中的 IDLE 中执行时不会出现在 IDLE 之外执行程序时出现的消息框错误

Message Box Error when executing program outside of IDLE that doesn't occur when executing in IDLE in Python 3.4

我有一些代码可以在按下按钮时创建一个消息框,当我 运行 我的程序处于空闲状态时,这没有问题,但是如果我 运行 程序之外IDLE 会报错 "name 'messagebox' is not defined" 为什么只有在 IDLE 之外执行时才会出现这种情况?

def Reset():
    ResetMess = messagebox.askyesno("Confirm Reset", "Are you sure?")

在 IDLE 之外,必须显式导入消息框

from tkinter import messagebox