There is a menu Option with two buttons, Show history and Clear history. The problem is, that the buttons are close one to another and it's easy to delete the history instead of showing it. This process is irreversible.
Possible solution
This can be easily fixed by doing the following:
Ask for confirmation before deleting the history.
(Optional) Add a separator between the two buttons.
Additional details
tkinter is used for the GUI, so you will need to use the documentation at tkdocs.com. You will be interested in the askyesno dialog (see here). The separator is described here. You will have to maybe add from tkinter import messagebox to the header.
The menu is created in the main class Calculator like this
Problem description
There is a menu
Option
with two buttons,Show history
andClear history
. The problem is, that the buttons are close one to another and it's easy to delete the history instead of showing it. This process is irreversible.Possible solution
This can be easily fixed by doing the following:
Additional details
tkinter
is used for the GUI, so you will need to use the documentation at tkdocs.com. You will be interested in theaskyesno
dialog (see here). Theseparator
is described here. You will have to maybe addfrom tkinter import messagebox
to the header.The menu is created in the main class
Calculator
like thishttps://github.com/SargonCZ/laser-calculator/blob/9675425834e7c90ecfbad657703596b9bdb31ffc/laser-calculator.py#L62-L70
Here, you will have to add the separator.
The
Clear history
is defined in this function:https://github.com/SargonCZ/laser-calculator/blob/9675425834e7c90ecfbad657703596b9bdb31ffc/laser-calculator.py#L132-L139
You have to add the confirmation there.