Module 'tkinter' has no attribute 'Tk'

Tkinter doesnt contain any tk attribute.

import tkinter

window = tkinter.Tk()

win.mainloop()

While running this code it gives me an error saying

module 'tkinter' has no attribute 'Tk'

Did you named your python file tkinter.py or Tkinter.py ? Try to rename it. It may be the cause.


Python 3.x

import tkinter

window = tkinter.Tk()

window.mainloop()

import tkinter

raiz= tkinter.Tk()

raiz.mainloop()

remember that the file name cannot be tkinter.py