Skip to content

Conversation

@ahme-spec
Copy link

@ahme-spec ahme-spec commented Jun 4, 2024

Addition of Operation History in Calculadora.py:

In this update, I added a "History" submenu to the main menu of the calculator to allow users to view and manage their operation history.

  1. This commit introduces two new methods: _show_history and _clear_history.

    • In _show_history, a new window (history_window) is created to display the calculation history.

    • The window is configured with a title, background color, and dimensions.

    • Entries from the self.history list, representing the calculation history, are iterated over, and labels are created for each entry.

    • These labels display the operation performed and its result.

    • Only the last 10 entries of the history are displayed

    • In _clear_history, the calculation history (self.history) is cleared, effectively removing all previous calculations from memory.

These changes enhance the functionality of the application by providing users with the ability to view their past calculations and clear the history.

  1. In the _create_menu function, which is responsible for creating and configuring the main menu of the application:

    • The modifications include adding a new submenu for the operation history.
    • A new Menu object is created and added to the main menu calc_menu under the label 'Historico'.
    • Two new commands are added to the history_menu submenu. The "Mostrar Histórico" command calls the _show_history
      method, which will display the operation history. The "Limpar Histórico" command calls the _clear_history method, which
      will clear the operation history.

Users can now easily review their calculation history and have the option to clear it.

@ahme-spec ahme-spec closed this Jun 4, 2024
@ahme-spec ahme-spec reopened this Jun 4, 2024
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.

2 participants