How to clear a field for text input in tkinter?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
24 views
I need to clear the field for text input in tkinter. I found this solution: entry.delete(0, END) Where entry is the name of the input field (the direct link to it) 0 - the beginning of the line input fields end - the end string of the input field. This should clear the input field from beginning to end. But here POPs up this error:
AttributeError: 'NoneType' object has no attribute 'delete'
Who is familiar with tkinter please help.
by | 24 views

2 Answers

0 like 0 dislike
Method place returns nothing, so the line of code

entry = Entry(canvas,width=20,).place(x=150,y=300,)

assigns the variable entry the value None

Correct on
entry = Entry(canvas, width=20,) entry.place(x=150, y=300)
by
0 like 0 dislike
First you need to obtain the field itself. You didn't get it.
within the class:
class Application(Tk): def OnEnterInput(self, event): text=u"+self.input.get() self.Send(text) self.input.delete(0, END) def createWidgets(self): ..... self.input = Entry(self, textvariable=self.inline) self.input.grid(row=0, column=0, columnspan=2, pady=3, padx=3, sticky='ew') self.input.bind(""self.OnEnterInput)

full code here
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
4 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
35,595 users