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.
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.
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.
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.
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.
In the _create_menu function, which is responsible for creating and configuring the main menu of the application:
will clear the operation history.
Users can now easily review their calculation history and have the option to clear it.