This code is a simple implementation of a Personal Finance Manager using Python's Tkinter for the graphical user interface (GUI), SQLite for database storage, and pandas for data manipulation. Here's a breakdown and explanation of the code:
The program allows users to manage their personal finances by setting budgets, adding expenses, viewing financial reports, and more.
-
SQLite Database:
- Two tables are created:
users
for storing user information andexpenses
for storing expense details. - The database is named
expenses.db
.
- Two tables are created:
-
Class: PersonalFinanceManager:
- Manages the main application and GUI.
-
GUI Components:
- Buttons for actions like setting budget, viewing budget, adding expenses, generating financial reports, logging in, registering, and deleting the account.
- Windows for login, registration, setting budget, increasing budget, and adding expenses.
-
Functions:
validate_login
: Validates user login credentials.validate_registration
: Validates new user registration.hash_password
andverify_password
: Hashes and verifies user passwords using SHA-256.set_budget
,view_budget
,increase_budget
,submit_increase_budget
: Handle budget-related functionalities.show_add_expense
,submit_expense
,get_total_expenses
: Handle expense-related functionalities.generate_report
,show_report
,download_csv
,get_expenses_by_year
: Generate and display financial reports.get_year_options
: Get available years for filtering financial reports.
-
Run the Application:
-
Login or Register:
-
Set Budget:
-
View and Increase Budget:
- After setting the budget, click "View Budget" to see the current budget.
- You can also increase the budget by clicking "Increase Budget."
-
Add Expenses:
-
Generate Financial Report:
-
Delete Account:
- Click "Delete Account" to delete your account permanently.
-
Log Out:
- Log out using the exit button or closing the application.
-
Python:
- Install Python on your system.
-
Libraries:
- Install required libraries using
pip install tkinter tkcalendar pandas
.
- Install required libraries using
-
SQLite:
- No additional installation needed; SQLite comes with Python.
- Security:
- This code uses a simple password hashing mechanism. In a real-world application, consider using more secure methods, such as bcrypt.
- Data Storage:
- The user's data is stored in a local SQLite database. In a production environment, consider using a more robust database solution.
Ensure that you have the required prerequisites installed before running the script.
-
Database Setup:
- Design and create SQLite database for expenses.
-
SQL Operations:
- Implement basic SQL operations for expense records.
-
Advanced Queries:
- Develop SQL queries for monthly and yearly summaries.
-
Database Initialization Script:
- Write Python script to initialize the database.
-
GUI Development:
- Create Tkinter-based GUI for Personal Finance Manager.
-
User Input Handling:
- Implement input validation for expense details.
-
Report Generation:
- Develop Python functions for financial reports.
-
CSV Export Functionality:
- Implement CSV export for expense data.
-
Integration:
- Ensure smooth integration of SQL and Python components.
-
Testing and Bug Fixing:
- Conduct thorough testing and address bugs.
-
Documentation:
- Document code and provide inline comments.
-
Code Review:
- Review code for best practices and style.
- All rights reserved. Strictly subject to copyright laws. © 2023 by gadagojushiva.