๐ Python (Tkinter) ย |ย
๐ SQLite Database ย ย
A secure desktop application built with Python Tkinter for tracking monthly expenses with SDG-aligned financial insights. This tool helps users monitor utility bills, categorized spending, and visualize trends to promote responsible consumption.
- Login system with password hashing (SHA-256)
- Protected user sessions
- Secure logout functionality
- Monthly utility bills (Water & Electricity)
- Categorized spending with 6 custom categories
- Automatic total calculation
- SDG-aligned tips for sustainable spending
- Total Expense Trend line graph
- Breakdown Trend visualization (Water/Electricity/Others)
- Interactive charts with Matplotlib integration
- Dark theme optimized for readability
- CRUD operations (Create, Read, Update, Delete)
- Sorting capabilities by date, highest/lowest total
- Transaction categorization system
- Month-to-month comparison with warnings
- Goal 6 (Clean Water) - Water conservation tips
- Goal 7 (Affordable Energy) - Electricity saving strategies
- Goal 12 (Responsible Consumption) - Spending awareness
- Goal 13 (Climate Action) - Energy reduction advice
Python 3.8 or higher
pip package manager- Clone/Download the repository
- Install required packages:
pip install tkinter matplotlib- Run the application:
python expenses_tracker.py| Component | Technology |
|---|---|
| GUI Framework | Tkinter |
| Database | SQLite3 |
| Data Visualization | Matplotlib |
| Security | Hashlib (SHA-256) |
| Date Handling | datetime |
id- Primary Keyusername- Unique identifierpassword_hash- Securely hashed password
id- Primary Keymonth- YYYY-MM formatwater- Water bill amountelectricity- Electricity bill amountothers- Total categorized spendingtotal- Sum of all expenses
id- Primary Keymonth- Reference to expenses.monthcategory- Spending categorydescription- Transaction detailsamount- Individual transaction value
- Clean authentication interface
- Password masking
- Error handling for invalid credentials
- Left Panel: Data entry and controls
- Right Panel: Expense table and graphs
- Color-coded buttons for different actions
- Add/edit/delete categorized expenses
- 6 predefined categories:
- ๐ Food & Groceries
- ๐ Transport
- ๐ฅ Healthcare
- ๐ฑ Sustainable Goods
- ๐ธ Wasteful Spending
- ๐ฌ Entertainment
- Line graphs for trend visualization
- Color-coded data series
- Interactive display updates
Username: admin
Password: password123
- Enter month in
YYYY-MMformat - Input water and electricity bills
- Click "๐พ SAVE EXPENSES"
- Click "๐ Manage Spending"
- Add transactions with categories
- Track detailed spending habits
- View "Total Trend" for overall spending
- Use "Breakdown Trend" for category analysis
- Sort data by different criteria
- Select from table to edit
- Use "โ๏ธ UPDATE RECORD" to modify
- "๐๏ธ DELETE SELECTED" to remove
| SDG Goal | Implementation |
|---|---|
| Goal 6 | Water usage warnings & conservation tips |
| Goal 7 | Electricity monitoring & efficiency suggestions |
| Goal 12 | Responsible consumption tracking |
| Goal 13 | Climate action through reduced energy use |
The application provides personalized tips when spending increases in specific categories, promoting sustainable financial habits aligned with UN Sustainable Development Goals.
| Color | Hex | Usage |
|---|---|---|
| Primary | #0F1E3A |
Main background |
| Secondary | #1B3A64 |
Panels & frames |
| Accent | #4DEAEF |
Buttons & highlights |
| Text | #EFEFEF |
All text elements |
| Button | #2D5A8E |
Action buttons |
| Delete | #9E2A2B |
Delete operations |
| Manage | #167A6E |
Transaction management |
- Password hashing using SHA-256
- SQL injection prevention through parameterized queries
- Session management with proper logout
- Input validation on all fields
- Month format:
YYYY-MMvalidation - Currency input: Peso symbol handling
- Positive values: No negative amounts
- Duplicate prevention: Unique month constraint
The application provides proactive warnings:
- Zero input detection - Alerts for missing data
- Spike warnings - Notifies when expenses increase
- SDG tips - Sustainable spending advice
- Save confirmation - Prevents accidental deletions
Edit the CATEGORIES list in the code to add/remove spending categories:
CATEGORIES = ['Food & Groceries', 'Transport', 'Healthcare',
'Sustainable Goods', 'Wasteful Spending', 'Entertainment']Update the color constants at the top of the file:
PRIMARY_COLOR = "#0F1E3A"
SECONDARY_COLOR = "#1B3A64"
ACCENT_COLOR = "#4DEAEF"Modify the SDG_TIPS dictionary for customized advice:
SDG_TIPS = {
"water": "Your custom water saving tip here",
# ... other categories
}expenses_tracker.py # Main application file
expenses_tracker.db # SQLite database (auto-generated)
README.md # This documentation
-
"Database is locked"
- Close all instances of the application
- Delete the .db file and restart
-
Graph not displaying
- Ensure matplotlib is installed:
pip install matplotlib - Check Python version compatibility
- Ensure matplotlib is installed:
-
Login failing
- Default credentials: admin/password123
- Database might be corrupted - delete and restart
- "Invalid month format": Use YYYY-MM (e.g., 2024-03)
- "Already exists": Each month can only have one record
- "No record selected": Click on a table row before editing/deleting
Planned features for upcoming versions:
- ๐ฑ Multiple currency support
- ๐ฑ Mobile companion app
- โ๏ธ Cloud backup functionality
- ๐ค AI-powered spending predictions
- ๐ฅ Multi-user household support
- ๐ Export to PDF/Excel reports
- ๐ Households tracking monthly expenses
- ๐ฑ Eco-conscious individuals monitoring resource usage
- ๐ผ Small businesses managing operational costs
- ๐ Students learning financial literacy
- ๐ Researchers analyzing consumption patterns
This project is developed for educational purposes with a focus on:
- Financial literacy promotion
- SDG awareness integration
- Practical Python application development
- UN SDGs for sustainable development framework
- Python community for excellent libraries
- Tkinter for robust GUI framework
For issues or questions:
- Check the troubleshooting section above
- Review the code comments for specific functions
- Ensure all dependencies are properly installed
# On first run, the database will be created automatically
# Default login credentials:
# Username: admin
# Password: password123
python expenses_tracker.py๐ Remember: Tracking expenses is the first step toward financial responsibility and sustainable living! This tool not only helps you save money but also contributes to global sustainability goals through conscious consumption.