Skip to content Skip to sidebar Skip to footer

Getting Traceback And AttributeError: 'NoneType' Object Has No Attribute 'get'

So I am trying to make a simple calculator program using Tkinter and python. I have some general code down for addition and subtraction but am getting this error. Please advise,

Solution 1:

entry = Entry(root).grid()

entry is None here, because grid doesn't return anything. Perhaps you meant to do:

entry = Entry(root)
entry.grid()

Solution 2:

I am kind of new, yes, but let me share what I've learned.

Appending .grid() in the widget´s creation line works flawlessly most of the times for layout purpose, but is not a good practice. The correct thing is to make a new line like Kevin said.


Post a Comment for "Getting Traceback And AttributeError: 'NoneType' Object Has No Attribute 'get'"