๐ฏ Project Objective
To build a To-Do List Application in Python that allows users to add, edit, delete, and mark tasks as completed with a simple and intuitive GUI.
Skills Demonstrated:
- Tkinter GUI development
- File handling (CSV/JSON)
- Event handling and widget manipulation
- Persistent data storage
Project Description
The To-Do List App lets users:
- Add daily tasks
- Mark tasks as done or pending
- Delete completed tasks
- Save and load tasks automatically
Use Cases:
- Personal productivity tool
- Student homework tracker
- Daily goal planner
๐งฉ Example Code โ To-Do List GUI App (Tkinter)
import tkinter as tk
from tkinter import messagebox
import json
import os
# File to store tasks
TASK_FILE = "tasks.json"
# Load existing tasks
if os.path.exists(TASK_FILE):
with open(TASK_FILE, "r") as f:
tasks = json.load(f)
else:
tasks = []
# Save tasks to file
def save_tasks():
with open(TASK_FILE, "w") as f:
json.dump(tasks, f)
# Add new task
def add_task():
task = entry_task.get().strip()
if task:
tasks.append({"task": task, "done": False})
update_listbox()
save_tasks()
entry_task.delete(0, tk.END)
else:
messagebox.showwarning("Warning", "Please enter a task!")
# Delete selected task
def delete_task():
selected = listbox_tasks.curselection()
if selected:
index = selected[0]
tasks.pop(index)
update_listbox()
save_tasks()
else:
messagebox.showwarning("Warning", "Select a task to delete!")
# Mark task as done
def mark_done():
selected = listbox_tasks.curselection()
if selected:
index = selected[0]
tasks[index]["done"] = True
update_listbox()
save_tasks()
else:
messagebox.showwarning("Warning", "Select a task to mark as done!")
# Update listbox display
def update_listbox():
listbox_tasks.delete(0, tk.END)
for i, task in enumerate(tasks):
status = "โ
" if task["done"] else "โ"
listbox_tasks.insert(tk.END, f"{status} {task['task']}")
# GUI setup
root = tk.Tk()
root.title("To-Do List App")
root.geometry("400x400")
tk.Label(root, text="Enter a new task:", font=("Arial", 12)).pack(pady=5)
entry_task = tk.Entry(root, width=35)
entry_task.pack(pady=5)
# Buttons
frame_buttons = tk.Frame(root)
frame_buttons.pack(pady=10)
tk.Button(frame_buttons, text="Add Task", command=add_task).grid(row=0, column=0, padx=5)
tk.Button(frame_buttons, text="Mark Done", command=mark_done).grid(row=0, column=1, padx=5)
tk.Button(frame_buttons, text="Delete Task", command=delete_task).grid(row=0, column=2, padx=5)
# Task list display
listbox_tasks = tk.Listbox(root, width=50, height=15)
listbox_tasks.pack(pady=10)
update_listbox()
root.mainloop()
โ Output
A GUI window with:
- Text entry field to add new tasks
- Listbox showing tasks with โ (done) or โ (pending)
- Buttons to add, delete, and mark tasks
- Automatic save and load from
tasks.json
โ Key Features
Extensible for more advanced features
Simple, user-friendly GUI
Task management (add, delete, mark done)
Persistent storage (JSON file)
Status tracking with visual indicators

Leave a Reply