Skip to content
Groot Institute of Technology

How to Build a Desktop Expense Tracker Using Python Tkinter

Python desktop application project for beginners

How to Build a Desktop Expense Tracker Using Python Tkinter

By Groot Institute Team · 24 Nov 2026 · 8 min read

How to Build an Expense Tracker Using Python Tkinter: A Complete Beginner's Project

Introduction

Python is one of the most popular programming languages for beginners as well as professional developers. It is widely used in software development, automation, data analysis, artificial intelligence and desktop application development.

One of the best ways to improve your Python programming skills is by building practical projects.

In this tutorial, we will learn how to build a Desktop Expense Tracker Application using Python Tkinter. This project will help beginners understand how to create a graphical user interface (GUI), accept user input, validate information, store records in a CSV file and display saved transactions in a table.

Imagine having a simple desktop application where you can enter your daily expenses, select their categories, save transaction details and calculate your total spending. Instead of maintaining a manual notebook, you can manage your expenses using a Python application.

By the end of this tutorial, you will have developed a functional Expense Tracker with an interactive interface and permanent CSV-based data storage.

What you will learn:

  • Python GUI development using Tkinter.
  • Creating windows, labels, buttons and input fields.
  • Handling user input and button-click events.
  • Validating expense information.
  • Saving records using Python CSV file handling.
  • Displaying transactions using the Treeview widget.
  • Calculating total expenses.
  • Building a complete desktop application.

Let's start building the project step by step.


1. What Is Python Tkinter?

Tkinter is Python's standard library for creating Graphical User Interface (GUI) applications.

A GUI allows users to interact with software through visual elements instead of typing commands into a terminal.

For example, when you open a desktop application, you normally see a window containing buttons, text fields, menus, labels and tables. These elements make the application easier to use.

Tkinter provides different widgets that help developers create these interfaces using Python.

Important Tkinter widgets

| Widget | Purpose |
|---|---|
| Tk() | Creates the main application window |
| Label | Displays text or information |
| Entry | Accepts single-line user input |
| Button | Performs an action when clicked |
| Combobox | Provides a dropdown selection |
| Frame | Organises widgets into sections |
| Treeview | Displays information in rows and columns |
| LabelFrame | Groups related interface elements |

Why use Tkinter?

  • It is beginner-friendly.
  • It comes with standard Python installations in many environments.
  • It does not require HTML or CSS.
  • It supports interactive desktop applications.
  • It can work with CSV files and databases.
  • It is useful for learning GUI programming concepts.

In this project, we will use Tkinter to create the Expense Tracker interface.

2. Project Overview and Features

Before writing the code, let's understand what we are going to build.

Our Expense Tracker will allow users to enter their daily expenses and maintain a record of their spending.

Main features of the application

1. Add Daily Expenses

Users can enter their daily spending details into the application.

2. Enter Expense Name and Amount

For example:

  • Grocery – ₹1,500
  • Electricity Bill – ₹2,000
  • Petrol – ₹1,000
  • Restaurant – ₹800

3. Select Expense Category

Users can select a category from a dropdown menu.

Suggested categories:

  • Food
  • Travel
  • Shopping
  • Bills
  • Education
  • Entertainment
  • Healthcare
  • Other

4. Choose Expense Date

Users can enter the date on which the expense occurred. The current date will be selected automatically when the application opens.

5. View Saved Transactions

All saved expenses will be displayed in a table.

6. Calculate Total Expenses

The application will automatically calculate the total amount of all recorded expenses.

7. Clear Form Fields

Users can clear the input fields after entering an expense or when they want to start again.

Project workflow

The application will work in the following sequence:

User enters expense details → Python validates the information → Data is saved in CSV → Transactions appear in a table → Total expenses are calculated.

3. Requirements and Installation

Before starting the project, we need to prepare our development environment.

Software requirements

You will need:

  1. Python
  2. Visual Studio Code (VS Code) or another Python IDE
  3. Tkinter
  4. Basic knowledge of Python

Step 1: Install Python

Visit the official Python website:

https://www.python.org/downloads/

Download the appropriate Python version for your operating system.

During installation on Windows, select the option:

Add Python to PATH

This allows you to run Python commands from the terminal.

Step 2: Verify Python installation

Open Command Prompt and execute:

python --version

If Python is installed correctly, you will see its version.

Step 3: Install Visual Studio Code

Visit:

https://code.visualstudio.com/

Download and install Visual Studio Code.

Open VS Code and install the official Python extension from Microsoft.

Step 4: Check Tkinter installation

Tkinter is included with many standard Python installations.

To check whether it is available, execute:

python -m tkinter

If a small Tkinter test window opens, the installation is working.

On some Linux systems, you may need to install the separate Tkinter package through your operating system's package manager.

Note: We do not need to install an additional package for CSV handling because Python already includes the built-in csv module.

4. Create the Python Project

Now let's create our project folder.

Create a folder named:

Python_Expense_Tracker

Open this folder in Visual Studio Code.

Inside the folder, create a Python file:

expense_tracker.py

Our project structure will look like this:

Python_Expense_Tracker/
│
├── expense_tracker.py
│
└── expenses.csv

The expense_tracker.py file will contain our application code.

The expenses.csv file will store expense records. Our program will create this file automatically when the first expense is saved.

5. Design the Expense Tracker Interface

The next step is creating the graphical interface.

Our application will contain:

  • Main application window.
  • Expense name input field.
  • Amount input field.
  • Category dropdown.
  • Date input field.
  • Description field.
  • Add Expense button.
  • Clear button.
  • Expense history table.
  • Total expense display.

Understanding the main window

Tkinter uses the Tk() function to create the main application window.

Example:

import tkinter as tk

root = tk.Tk()

root.title("Expense Tracker")

root.geometry("950x600")

root.mainloop()

Let's understand the code:

  • import tkinter as tk imports the Tkinter library.
  • tk.Tk() creates the application window.
  • title() sets the window title.
  • geometry() defines the window size.
  • mainloop() keeps the application running and responds to user interactions.

Creating input fields

We will use the Label and Entry widgets to collect expense information.

For example:

name_label = tk.Label(root, text="Expense Name")

name_label.pack()

name_entry = tk.Entry(root)

name_entry.pack()

The label displays the field name, while the Entry widget allows users to type information.

We will use a ttk.Combobox for selecting the expense category and a ttk.Treeview for displaying saved records.

6. Create the Add Expense Function

Now we need to create a function that collects information entered by the user.

This function will:

  1. Read the expense name.
  2. Read the amount.
  3. Read the selected category.
  4. Read the expense date.
  5. Read the description.
  6. Validate the entered information.
  7. Save valid expense details.

Why is input validation important?

Suppose a user enters:

  • An empty expense name.
  • A negative amount.
  • Text instead of a numerical amount.
  • An incorrectly formatted date.

The application should not accept invalid information.

We can use Python's if conditions and exception handling to validate user input.

Example:

amount = "1500"

try:
    amount = float(amount)

    if amount <= 0:
        print("Amount must be greater than zero.")

    else:
        print("Valid expense amount.")

except ValueError:
    print("Please enter a valid number.")

The try-except block prevents the application from crashing when an invalid numerical value is entered.

7. Save Expense Records in a CSV File

Now let's understand how the application will store information.

CSV stands for Comma-Separated Values.

It is a simple file format used to store tabular information.

For example, an expense record may contain:

| Expense Name | Amount | Category | Date |
|---|---:|---|---|
| Grocery | 1500 | Food | 2026-11-24 |
| Petrol | 1000 | Travel | 2026-11-24 |
| Electricity Bill | 2000 | Bills | 2026-11-24 |

Python provides a built-in library called csv for reading and writing CSV files.

Example: Writing data into a CSV file

import csv

with open("expenses.csv", "a", newline="") as file:

    writer = csv.writer(file)

    writer.writerow([
        "Grocery",
        1500,
        "Food",
        "2026-11-24"
    ])

Let's understand this code:

  • import csv imports the CSV module.
  • open() opens the CSV file.
  • "a" means append mode, which adds new records without deleting existing ones.
  • csv.writer() creates a CSV writer.
  • writerow() writes one record into the file.

Our complete application will automatically save every valid expense record into the CSV file.

8. Display Expense Records in a Table

Saving information is not enough. Users should also be able to view their saved expenses.

For this purpose, we will use the Treeview widget from Tkinter's ttk module.

Treeview allows us to display information in a structured table.

Our table will contain these columns:

| Date | Expense Name | Category | Amount |
|---|---|---|---:|
| 2026-11-24 | Grocery | Food | ₹1,500 |
| 2026-11-24 | Petrol | Travel | ₹1,000 |
| 2026-11-24 | Electricity Bill | Bills | ₹2,000 |

Example:

Courses related to this article

  • Python course at Groot Institute, Zirakpur

    Python

    Analyze data, build models, and communicate insights with Python. (Beginner · 14 weeks)

Keep reading