模块“tkinter"没有属性“Tk" [英] Module 'tkinter' has no attribute 'Tk'

查看:163
本文介绍了模块“tkinter"没有属性“Tk"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Tkinter 不包含任何 tk 属性.

Tkinter doesnt contain any tk attribute.

import tkinter

window = tkinter.Tk()

win.mainloop()

运行此代码时出现错误提示

While running this code it gives me an error saying

module 'tkinter' has no attribute 'Tk'

推荐答案

你的 python 文件命名为 tkinter.py 还是 Tkinter.py ?尝试重命名它.这可能是原因.

Did you named your python file tkinter.py or Tkinter.py ? Try to rename it. It may be the cause.

这篇关于模块“tkinter"没有属性“Tk"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆