2

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()
Sten
  • 37
  • 6

1 Answers1

1

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.

Samwise
  • 68,105
  • 3
  • 30
  • 44