Skip to content Skip to sidebar Skip to footer

Python Calculator

I found this calculator code in the web. I want to add some function, like the pow() but it returns an error. The error: button(powF, LEFT, 'pow', lambda w=display: w.set(w.pow())

Solution 1:

you can't give the display as parameter to the pow function, it expects a number. and don't forget to set the display.

   powF = frame(self, BOTTOM)
   button(powF, LEFT, 'pow', lambda w=display: w.set(pow(float(w.get()),2)))

Post a Comment for "Python Calculator"