Unsolved reference 'Tk'?

Question:

I am trying to learn tkinter and how to make GUIs with it, but PyCharm is giving me an error as "Unresolved reference ‘Tk’ "
My code:

from tkinter import *

root = Tk()
Asked By: Sten

||

Answers:

It sounds like you have a file in your project called tkinter.py that’s shadowing the tkinter module. (The path to the "real" tkinter would be something like Python/Python310/lib/tkinter/__init__.py, whereas the path tkinter.py in the error message indicates a file in your project’s root path.)

To fix the problem, rename or move your tkinter.py file.

Answered By: Samwise
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.