Personal Expense Tracker is a financial management tool that helps users categorize and track their spending habits. It applies data structures for organizing expenses and includes basic data visualization capabilities for spending analysis.
What it does
- Add and categorize expenses
- Track spending by category
- View expense history
- Basic data visualization
- Persistent data storage
From the code
import tkinter as tk
from tkinter import ttk, messagebox
expenses = []
categories = ["Food", "Transport", "Entertainment", "Bills", "Other"]
def add_expense():
amount = amount_entry.get()
category = category_combo.get()
description = desc_entry.get()
if not amount or not category:
messagebox.showwarning("Error", "Please fill all fields")
return
try:
amount = float(amount)
expenses.append({
"amount": amount,
"category": category,
"description": description
})
update_list()
clear_entries()
except ValueError:
messagebox.showwarning("Error", "Invalid amount")
def update_list():
expense_list.delete(0, tk.END)
total = 0
for exp in expenses:
text = "$" + str(exp['amount']) + " - " + exp['category']
expense_list.insert(tk.END, text)
total += exp['amount']
total_label.config(text="Total: $" + str(total))
root = tk.Tk()
root.title("Expense Tracker")
root.geometry("400x500")
amount_entry = tk.Entry(root)
category_combo = ttk.Combobox(root, values=categories)
desc_entry = tk.Entry(root)
root.mainloop()


