In Class practice Review: Loan Calculator Program
Developed a console-based program for computing loans.
This section develops a GUI application for computing loan payments
Developing a GUI application involves designing the user interface and writing the code to process the events. Here are the major steps in writing the program:
-
Design the user interface (UI) by drawing a sketch. The UI consists of labels, text entry boxes, and a button. You can use the grid manager to position them in the window. WE will use MS Visio in class to replicated the Wire-frame Diagram attached below. If you are doing this activity from a distance and do not have access to MS Visio, you may use MS Word Tables to simulate the grid layout.
-
Process the event. When the button is clicked, the program invokes a callback function to obtain the user input for the interest rate, number of years, and loan amount from the text entries, computes the monthly and total payments, and displays the values in the labels. We will review the code in the attached program to better understand building a GUI and implementing event driven programming in a GUI
Loan Calculator Wireframe.png Download Loan Calculator Wireframe.png
LoanCalculator.py Download LoanCalculator.py
Process Flow of building the GUI
- create window
- create labels
- create entries
- create button
- callback
- computePayment
- set monthlyPayment
- set totalPayment
- getMonthlyPayment
- create GUI
- Process Flow of building the GUI
- create window
- create labels
- create entries
- create button
- callback
- computePayment
- set monthlyPayment
- set totalPayment
- getMonthlyPayment
- create GUI