Math Tools GUI: The Same Calculators, Now With Windows
The CLI version worked. Type a number, press enter, get an answer. But a menu printed in a terminal limits how much information you can show at once. The GUI version put each tool in its own window with labeled inputs, dropdown selectors, and a calculate button. Same math. Better presentation.
One Window Per Tool
The main screen shows seven buttons. Area, volume, surface area, angles, hypotenuse, prime check, quadratic solver. Clicking one opens a Toplevel window with the inputs for that specific calculation. The main window stays open in the background, so switching between tools is closing one window and clicking the next button.
Each tool follows the same structure. A StringVar for the result. An inner calculate function that reads the inputs, runs the math, and updates the label. Error handling wraps the calculation in try/except and shows a messagebox on failure. The pattern repeats seven times with different formulas.
What the GUI Changed
Dropdown menus replaced text prompts for shape selection. Instead of typing the number for sphere, the user picks Sphere from an OptionMenu. All input fields are created at window startup regardless of the selection, so choosing a different shape does not redraw the layout. It just means some fields sit empty.
Error handling improved automatically. A terminal program that crashes prints a traceback and exits. A GUI program that crashes closes the window and leaves the main screen running. The messagebox calls catch bad inputs and show a readable error without terminating anything.
What Did Not Change
The formulas are the same. The math module calls are the same. The quadratic solver still checks the discriminant for the same three cases. The prime check still divides up to the square root. The unused imports from numpy and matplotlib carried over from the CLI version and were never removed.
The individual calculators in the GUI are not better than their CLI counterparts. They are easier to use. That is the only difference, and it is the right difference to make.