Pseudo Code for Tkinter Calculator using Eval Statement
Setup
Function to handles numbers and decimal point
Just append the number or decimal point to the stringToEvaluate variable
- Called with parameter that's either a number or a decimal point. Strings in either case.
- global stringToEvaluate
- stringToEvaluate = stringToEvaluate + parameter
Function with math operator
Evaluate what's in stringToEvaluate and then append the math operator we got to it and put it back in stringToEvaluate
- Called with a parameter that's a 1 character string of +, -, *, or /
- global stringToEvaluate
- if current stringToEvaluate is "" (empty like I originally set it) only the minus sign makes sense.
if
#tagcheck
tagcheck