0

I am working on an Entry, or Input if you please, in Python using a Library called tkinter

This is the code I have used:

entryvar = Entry(name).pack()
entryvar.insert(0,'Enter')

But when I run the code, I get the following error:

AttributeError: 'NoneType' object has no attribute 'insert'

I am not sure why this is happening as i carefully followed a tutorial on this.

I have tried switching the single inverted commas to double inverted commas and then back, but that didn't work. If you have any suggestions, It would help. Thanks!

1 Answers1

0

You are getting this error because you wrote entryvar = Entry(name).pack(). . .pack() returns as None so you should write:

entryvar = Entry(name)
entryvar.pack()
entryvar.insert(0,'Enter')
Shounak Das
  • 350
  • 12