Simple To-Do Task Manager with Python Tkinter Simple To-Do Task Manager with Python Tkinter

Simple To-Do Task Manager with Python Tkinter

image

A user-friendly and interactive To-Do Task Manager built using Python’s Tkinter library. This lightweight desktop application allows users to easily add, view, and complete their daily tasks through a clean graphical interface. Perfect for beginners looking to practice Python GUI development and task management basics.

				
					# gui_todo_manager.py
import tkinter as tk
from tkinter import messagebox

class TodoApp:
    def __init__(self, root):
        self.root = root
        self.root.title("DevCode- Task Manager")
        self.root.geometry("400x450")
        self.root.config(bg="#f0f0f0")

        self.tasks = []

        self.title_label = tk.Label(root, text="To-Do Task Manager", font=("Helvetica", 16, "bold"), bg="#f0f0f0")
        self.title_label.pack(pady=10)

        self.entry = tk.Entry(root, width=30, font=("Helvetica", 12))
        self.entry.pack(pady=5)

        self.add_btn = tk.Button(root, text="Add Task", command=self.add_task, bg="#4CAF50", fg="white", width=15)
        self.add_btn.pack(pady=5)

        self.task_listbox = tk.Listbox(root, width=40, height=10, font=("Helvetica", 12), selectmode=tk.SINGLE)
        self.task_listbox.pack(pady=10)

        self.delete_btn = tk.Button(root, text="Complete Task", command=self.delete_task, bg="#f44336", fg="white", width=15)
        self.delete_btn.pack()

    def add_task(self):
        task = self.entry.get().strip()
        if task:
            self.tasks.append(task)
            self.update_listbox()
            self.entry.delete(0, tk.END)
        else:
            messagebox.showwarning("Input Error", "Please enter a task.")

    def delete_task(self):
        selected = self.task_listbox.curselection()
        if selected:
            index = selected[0]
            self.tasks.pop(index)
            self.update_listbox()
        else:
            messagebox.showwarning("Selection Error", "Please select a task to complete.")

    def update_listbox(self):
        self.task_listbox.delete(0, tk.END)
        for task in self.tasks:
            self.task_listbox.insert(tk.END, task)

# Run the GUI app
if __name__ == "__main__":
    root = tk.Tk()
    app = TodoApp(root)
    root.mainloop()