如何在 python 3.3.0 中导入 Tkinter
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17365747/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to import Tkinter in python 3.3.0
提问by Abrar Hussain
I run python version 3.3.0 and when to try to import Tkinter
in command window, I get this type of error:
我运行 python 版本 3.3.0,什么时候尝试import Tkinter
在命令窗口中运行,我收到这种类型的错误:
>>> import Tkinter
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import Tkinter
ImportError: No module named 'Tkinter'
>>>
Please help me out how to solve this problem.
请帮我解决这个问题。
回答by Sky Flyinz
You should use tkinter with first letter "t" must be lower case-sensitive for Python 3.
对于 Python 3,您应该使用 tkinter 的首字母“t”必须是小写敏感的。
回答by Hyman Stout
The name changed in Python 3. Try tkinter
with a lowercase 't'.
Python 3 中的名称已更改。尝试tkinter
使用小写的“t”。
Many modules were renamed, modified, or forked when Python moved from 2.x to 3.x. I like to use
当 Python 从 2.x 迁移到 3.x 时,许多模块被重命名、修改或分叉。我喜欢用
>>> help('modules')
to see a list of current module names. This works in all versions.
查看当前模块名称的列表。这适用于所有版本。