我的代码给了我这个错误,我不能为我的生活弄清楚为什么它告诉我“NameError:name'Button'没有被定义。”在Tkinter中,我认为Button应该添加一个按钮?为什么我的代码返回“名称”按钮“未定义”?
import Tkinter
gameConsole = Tkinter.Tk()
#code to add widgets will go below
#creates the "number 1" Button
b1 = Button(win,text="One")
gameConsole.wm_title("Console")
gameConsole.mainloop()
按钮是'TKinter'命名空间的一部分。使用'TKinter.Button(...)'。请记住,对于新的代码库,推荐的解释器版本是Python 3. Python 2支持在2020年结束。 –