I'm that guy who had an problem with a calculator.thanks to Joran Beasley I've got my problem better.But now i have this problem.
Code:a part was
intery.config(intery+intery2)
print(su)
now its:
def su():
int(Entery.get())
New Error:
TypeError: get() missing 1 required positional argument: 'self'
I'll be happy if Mr.Beasley Will help me.
It looks like you're calling a method ( get
) on a class ( Entery
). That's not working because the method expects to be called on an instance of the class, rather than the class itself.
I don't know enough about your program to guess where you should be creating the instance, but here's the general idea:
# somewhere in your code:
entery = Entery() # maybe pass some args?
# later
def su():
return int(entery.get()) # call on the saved instance
I'd added a return
to your function, as otherwise you'd be converting the return value of get()
to an int
and then immediately throwing that integer away. I suppose you might choose to do something else with it, but again, I don't know enough about your code to guess.
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.