Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of "AttributeError: NoneType object has no attribute tk"?

Tags:

python

tkinter

What does the following error message mean?

AttributeError: 'NoneType' object has no attribute 'tk'
like image 357
aneuryzm Avatar asked Dec 02 '22 04:12

aneuryzm


1 Answers

I have had this problem but found the solution. This problem arises when you declare the variable before you make an instance of Tk().

For example, this will bring the error

count = IntVar()
....
....
app = Tk()

Solution!! Make the declarations after creating a tkinter application window

app = Tk()
....
count = IntVar()
like image 84
Holy Genius Avatar answered Mar 26 '23 21:03

Holy Genius