[英]Why am I getting an importing error for tkinter with the code below?
I am a newby to python and am struggling with the basic code below.我是 python 的新手,正在为下面的基本代码苦苦挣扎。 I am uncertain why I am not getting a Tk window to open.
我不确定为什么我没有打开 Tk window。 The code I have thus far is:
到目前为止我的代码是:
import tkinter as tk
from tkinter import tkk
class Application(tk.Tk):
"""Application root window"""
if __name__ == "__main__":
app = Application()
app.mainloop()
The error I receive back from my terminal is:我从终端收到的错误是:
ImportError: cannot import name 'tkk' from 'tkinter'
(/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/__init__.py)
Any ideas?有任何想法吗?
Try this out instead: from tkinter import ttk
.试试这个:
from tkinter import ttk
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.