Module ‘tkinter’ has no attribute ‘Tk’

Posted on

Question :

Module ‘tkinter’ has no attribute ‘Tk’

Tkinter doesnt contain any tk attribute.

import tkinter

window = tkinter.Tk()


While running this code it gives me an error saying

module 'tkinter' has no attribute 'Tk'

Answer #1:

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

Answered By: Izalion

Answer #2:

Python 3.x

import tkinter

window = tkinter.Tk()

Answered By: Paras Dharasanda

Answer #3:

import tkinter

raiz= tkinter.Tk()


remember that the file name cannot be

Answered By: Ricardo Oviedo

Answer #4:

try ‘Tk’ instead of ‘tk’
it worked for me, if you think you are importing wrong,try:
import tkinter

Answered By: mitsu_senpai

Answer #5:

Try copying the file to the Python path in C drive (in my case)

And the folder should not contain any other file named or similar for Code click here

Answered By: Shrimad Bhagwat

Leave a Reply

Your email address will not be published.