79299687

Date: 2024-12-21 16:01:11
Score: 1
Natty:
Report link

import tkinter as tk

def add_task(): task = entry.get() if task: listbox.insert(tk.END, task) entry.delete(0, tk.END)

def delete_task(): try: selected_task_index = listbox.curselection()[0] listbox.delete(selected_task_index) except IndexError: pass

root = tk.Tk() root.title("تطبيق قائمة المهام")

entry = tk.Entry(root, width=50) entry.pack(pady=10)

add_button = tk.Button(root, text="إضافة مهمة", command=add_task) add_button.pack(pady=5)

delete_button = tk.Button(root, text="حذف مهمة", command=delete_task) delete_button.pack(pady=5)

listbox = tk.Listbox(root, width=50, height=10) listbox.pack(pady=10)

root.mainloop()

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Family Hajjj