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.
if the file name is tkinter.py in program
import tkinter
it will imports the our file name which is overriders the content there is not Tk() module, so it throw the error
In my case, the error occurred in top =tk.Tk()
The simple trick I used was to change the uppercase K in 'TK' to lowercase k
import tkinter as tk
import tkinter.filedialog as fd
from tkinter import *
import PIL
from PIL import ImageTk
from PIL import Image
top =tk.Tk()
top.geometry('800x600')
top.title('Image Processing')
top.configure(background='#CDCDCD')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With