I got an task from the CrossRoads Team to build an calculator,
while the python Programing Challenge. From an Programmers mind I accepted the challenge
with hope, After start doing things gone worst but at last I completed.
Status: Developing for more features.
Stable Version: Version available in this repository is stable.
Latest update feature: In the old version their was a problem that When User inputs more character it will get out of the screen.
In this update I added an if statement under the btn_clicked funtion to excecute and check the length everytime user inputs. When the
display gets 11 character the charcter shows by two lines. When it gets 22 display gets full of character and decrease the character length and get upto 90
character.
Special Credits: CrossRoads Team and @AswinAsok (Hillarious Coder)
Author: Jobin S
Mail: jobins9633@gmail.com
note: There are many methods to do this work But here I am using my own logic and more
ideas that I got from researches.
In the interface I created Buttons and Label (for display) for user to interact
for the calculations. We pass argument to the btn_clicked function.
When an argument passes to this function it takes the latest string on the value variable and concatenate the argument number with it. And set the value variable to the label (Display). The mathematical operator showing on the screen while clicking it's button also uses this function But, instead of passing argument as numbers pass string (*,/,+ and -) for the apt operators use.
When we Entering calculations the Mathematical Calculation are stored in the value variable and shows on the label.When the user puts the calculations and enter equal button it calls the equal_btn function.
This function does'nt have any argument. When calling this function the mathematical problem containing variable passes to the build in eval function and it return the answer of the Mathematical Problem then the answer is assigned to the answer variable then it is setting to the label (Display). After these the value is set to none for avoiding concatenate with new mathematical problem.
This function clear all operations on label. The function assign value to none and set it to the label.
This function backspace the operations that shows in the label
Hover effect in the button is done by the enter and leave event. Here is the Reference