I keep trying to convert an entry and it keeps saying
TypeError: int() argument must be a string or a number, not 'Entry'
Here is part of my program:
self.answers = Entry(self)
self.answers.grid(row = 5, column = 3, sticky = W)
def update_text(self):
answers = self.answers
answer = int(answers)
if self.answer > the_number:
answer =("Lower...")
else:
answer =("Higher...")
tries += 1
I tried value = answers.get() and now its says
NameError: global name 'answers' is not defined
You need to get the entry's value:
value = answers.get()
This should return whatever string happens to be in the entry field when it is called.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.