Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding two new functions(% and log) in Calculadora.py #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jlozanopenagos
Copy link

Adding two new functions(% and log) in Calculadora.py and Calculador.py:

  1. Button Creation and Layout:
  • Two new buttons, labeled "log" and "%", have been added to the calculator interface.
  • These buttons are created with the appropriate text and styling to represent the logarithm and percentage operations.
  1. Event Handling:
  • Event handlers have been defined for the new buttons to capture user input and perform the corresponding operations.
  • The command attribute of the buttons is set to call specific methods when clicked.
  1. Expression Processing:
  • A new method _process_expression has been implemented to handle the processing of mathematical expressions containing the logarithm and percentage operations.
  • Within this method, the presence of the logarithm operation is detected, and if found, the logarithm function is evaluated and replaced with its result in the expression.
  • Error handling is included to deal with invalid arguments or operations, ensuring the stability of the calculator.
  1. Result Display:
  • The method _set_result_in_input has been updated to handle the display of results for expressions containing logarithms and percentages.
  • If an error occurs during evaluation, such as an invalid operation or division by zero, the method displays an appropriate error message.
  1. User Interface Interaction:
  • Users can now input logarithmic expressions by clicking the "log" button, followed by the number or expression inside parentheses. It can be use with others operations
  • Similarly, the "%" button allows users to input percentage calculations, which are then processed accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant