Delux_pro

🔹 Introduction

The current image has no alternative text. The file name is: ESLA.jpg

The To-Do List App is one of the most popular beginner projects. It teaches you how to:

  • Create a GUI with Tkinter.
  • Use Listbox to display tasks.
  • Add, delete, and mark tasks as done.
  • Save tasks to a file so they persist after closing the app.

🔹 Code Example

import tkinter as tk
from tkinter import messagebox

# ------------------------------
# Functions
# ------------------------------

def add_task():
    task = task_entry.get()
    if task != "":
        tasks_listbox.insert(tk.END, task)
        task_entry.delete(0, tk.END)
    else:
        messagebox.showwarning("Warning", "Please enter a task!")

def delete_task():
    try:
        selected_task = tasks_listbox.curselection()[0]
        tasks_listbox.delete(selected_task)
    except:
        messagebox.showwarning("Warning", "Please select a task to delete!")

def save_tasks():
    tasks = tasks_listbox.get(0, tk.END)
    with open("tasks.txt", "w") as f:
        for task in tasks:
            f.write(task + "\n")
    messagebox.showinfo("Saved", "Tasks saved successfully!")

def load_tasks():
    try:
        with open("tasks.txt", "r") as f:
            for task in f:
                tasks_listbox.insert(tk.END, task.strip())
    except FileNotFoundError:
        pass

# ------------------------------
# GUI Setup
# ------------------------------

root = tk.Tk()
root.title("📝 To-Do List App")
root.geometry("400x500")

# Task entry
task_entry = tk.Entry(root, width=30, font=("Arial", 12))
task_entry.pack(pady=10)

# Add button
add_button = tk.Button(root, text="➕ Add Task", width=20, command=add_task)
add_button.pack(pady=5)

# Listbox
tasks_listbox = tk.Listbox(root, width=40, height=15, font=("Arial", 12))
tasks_listbox.pack(pady=10)

# Buttons
delete_button = tk.Button(root, text="❌ Delete Task", width=20, command=delete_task)
delete_button.pack(pady=5)

save_button = tk.Button(root, text="💾 Save Tasks", width=20, command=save_tasks)
save_button.pack(pady=5)

# Load tasks at startup
load_tasks()

root.mainloop()

🔹 Features of This App

  1. Add Task ➝ Write in the input box and click Add Task.
  2. Delete Task ➝ Select a task in the list and click Delete Task.
  3. Save Tasks ➝ Saves all tasks into a file (tasks.txt).
  4. Auto Load ➝ When you restart the app, it automatically loads tasks from tasks.txt.

🔹 Example Run
  • User types “Study Python”, clicks Add Task → Task appears in the list.
  • User selects the task “Study Python”, clicks Delete Task → Task removed.
  • User clicks Save Tasks → All tasks saved to file.

🔹 Summary
  • Learned how to build a To-Do List App with Tkinter.
  • Practiced listbox, buttons, entry widgets.
  • Learned how to save and load data from a file.
⬇️ Download Delux_pro تحميل Server 1 ⬇️ Download Delux_pro تحميل Server 2

Related Posts

FlyFeditv

📘 Introduction In this project, you’ll create a command-line Expense Tracker that allows users to: ✅ Add expenses with category, amount, and description✅ View total spending and category breakdown✅ Automatically…

Read more

NetCinFly

📘 Introduction In this project, you’ll develop a Student Grades Analyzer in Python that can: This project helps you strengthen your skills with lists, dictionaries, loops, and data analysis logic….

Read more

Eagle_Pro

🌐 Introduction In this project, you’ll create a Web Scraper App in Python that extracts quotes, authors, and tags from a live website.You’ll use the BeautifulSoup and Requests libraries to…

Read more

Cobra_Pro

🌦️ Introduction In this project, you’ll build a Weather App in Python that retrieves live weather information from an online API.You’ll learn how to work with HTTP requests, JSON data,…

Read more

Show7-Pro

Concepts Covered: 🎯 Objective: Create a simple, text-based contact book application that allows users to: 💡 Code (contact_book.py): 🧠 Example Usage Console Output Example: 💾 Notes ⬇️ Download Show7-Pro تحميل…

Read more

Rapid_tv

🔹 Introduction The Rock, Paper, Scissors Game is a classic hand game that you can easily build in Python. 👉 Rules: 🔹 Code Example 🔹 Example Run 🔹 Concepts Learned…

Read more