简体   繁体   中英

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. I am uncertain why I am not getting a Tk window to open. 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM