import tkinter as tk
window = tk.Tk()
输出:
AttributeError:模块"tkinter"没有属性"Tk">
python文件的名称是什么?检查是tkinter.py
还是Tkinter.py
。
如果大写字母有问题,你可以更改你的线路:
import tkinter as tk
至:
import Tkinter as tk