gpt4 book ai didi

python - 属性错误 : 'module' object has no attribute 'Tk'

转载 作者:行者123 更新时间:2023-11-28 19:48:31 37 4
gpt4 key购买 nike

我开始使用 Tkinter python 库学习 GUI 开发,但我遇到了 PyCharm IDE 社区版 4.5.2 的问题

我的问题是:当我在 IDLE 中编写下面的代码时,它工作正常!!!但是当我使用 PyCharm IDE 编写它时,会出现此错误消息:AttributeError: 'module' 对象没有属性 'Tk'请帮助我,我真的需要帮助,非常感谢你

我的代码:

import Tkinter

app = Tkinter.Tk()
app.title("hello world")
app.minsize(300, 300)
helloLabel = Tkinter.Label(app, text="hello GUI")
helloLabel.pack()

app.mainloop()

注意:我使用的是 Python 2.7.6,操作系统:Ubuntu 14.04 LTS

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com