Home > Software design >  AttributeError: partially initialized module 'tkinter' has no attribute 'Tk' (mo
AttributeError: partially initialized module 'tkinter' has no attribute 'Tk' (mo

Time:01-16

Ok,ok,now i was trying myself with Tkinter,and I barely started and got this error

AttributeError: partially initialized module 'tkinter' has no attribute 'Tk' (most likely due to a circular import)

and I don't know how to fix it

This is my source code:

import tkinter
window = tkinter.Tk()
window.mainloop
window.geometry("200x200")

Maybe you could help me,that would be very nice, Thank You!

CodePudding user response:

You are using the tkinter library with all the code that makes tkinter function in a file called "tkinter.py". Python is trying to read that file however your file is likely also called "tkinter.py" which doesn't have the required code. You should try renaming your document and moving it to a new file.

  •  Tags:  
  • Related