一个刚从Tkinter开始的初学者的问题。我下载了它并编写了教程Hello World程序,它在IDLE中运行得很好。但是,当我保存程序并使用命令提示符运行它时,它们都返回NameError: name 'tk' is not defined.我也尝试转到主Python命令程序并手动输入代码,它工作得很好。代码只是所有教程教您编写的基本Hello World程序:root = Tk()
w = Label(root, text="
\test.py", line 6, in <module> File "c:\Users\...\Screenshot.py", line 18, in __init__NameError: name 'root'is not defined 班级: import time
from tkinter impo