0% found this document useful (0 votes)
8 views10 pages

1

The document describes a simple expense tracker application built with Python and Tkinter, allowing users to log, view, and manage expenses. Key features include adding, viewing, deleting, and sorting expenses, with a graphical user interface that utilizes entry fields and a treeview table. The application handles common errors and ensures data persistence through file handling with expenses.txt.

Uploaded by

Sarathi M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views10 pages

1

The document describes a simple expense tracker application built with Python and Tkinter, allowing users to log, view, and manage expenses. Key features include adding, viewing, deleting, and sorting expenses, with a graphical user interface that utilizes entry fields and a treeview table. The application handles common errors and ensures data persistence through file handling with expenses.txt.

Uploaded by

Sarathi M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Introduction

Objective:

• A simple expense tracker application built using


Python and Tkinter.

• Helps users log, view, and manage expenses.


Key
Features
Add Expense: Allows users to input a date,
category, and amount.

View Expenses: Displays a list of expenses


with the total expense calculated.

Delete Expense: Removes an expense from the


list based on selection.

Expense Sorting: Automatically sorts expenses


by amount in ascending order.
Core Modules Used

tkinter: Used for building the graphical user interface (GUI).

datetime: Used for date validation (format checking).

OS: Used to interact with the file system (checking if files


exist).
GUI Components
Entry Fields:

• Date Entry (DD-MM-YYYY format)


• Amount Entry
• Category Selection (Dropdown)

Treeview Table:
• Displays expenses (date, category, and amount).

• Sorted by amount.

Buttons:

Add Expense: To add new expense entries.

View Expenses: To refresh and display the updated list.

Delete Expense: To remove selected expense.


Add Expense Functionality

Code Explanation:

• User inputs date, category, and amount.

• The program validates the date and amount.

• If valid, it writes the expense to expenses.txt.

• Status messages are displayed (e.g., success, invalid input).

def add_expense():
# Code explanation here
View and Delete Expenses

View Expenses:

• Reads and displays all expenses from the file.

• Calculates total expense and sorts the records

Delete Expense:

• Removes an entry from the file based on user selection in the table.

def view_expenses():
# Code explanation here
File Handling and Storage

expenses.txt:

• The program reads and writes expense data from this


file.

• The file is created if it doesn't exist, ensuring data


persistence.
Error Handling

Common Errors Handled:

• Invalid date format (e.g., wrong format like MM-DD-YYYY).

• Invalid amount (non-numeric input).

• File access errors (e.g., issues with reading/writing the file).


Conclusion

• This expense tracker offers basic functionality for managing daily expenses.

• It’s an example of how Tkinter can be used to build interactive desktop applications with
Python.

You might also like