from another answer about tkinter issues I have tried the following code:
import tkinter
tkinter._test()
to which i get the error msg:
Traceback (most recent call last):
File "C:\Users\mickh\Dropbox\python code\helloWorld\GUI.py", line 1, in <module>
import tkinter
File "C:\Users\mickh\Dropbox\python code\helloWorld\tkinter.py", line 13, in <module>
root = tkinter.tk()
AttributeError: partially initialized module 'tkinter' has no attribute 'tk' (most likely due to a circular import).
My python version is 3.9.7 on windows 11
Also, the error msg says that the module is partially initialized. What does this mean?
I have looked at other answers to this question by I don't understand them
CodePudding user response:
You have a file named tkinter.py
in your project folder. When you do import tkinter
in your code, python will import that file rather than the installed tkinter module.
The solution is to rename tkinter.py
to something else.