Skip to content

Commit

Permalink
Merge pull request #1531 from KashishJuneja101003/main
Browse files Browse the repository at this point in the history
Fix: Prevent addition of empty or whitespace-only tasks
  • Loading branch information
Kushal997-das authored Oct 23, 2024
2 parents a9635f4 + c8d12ae commit 5ba5075
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions Desktop Application/Basic/Python/To-Do List/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@


def newTask():

task = my_entry.get()

task = my_entry.get().strip() # Strip leading/trailing whitespace
if task != "":

lb.insert(END, task)

my_entry.delete(0, "end")

else:

messagebox.showwarning("warning", "Please enter some task.")

messagebox.showwarning("Warning", "Please enter a valid task.")


def deleteTask():
Expand Down Expand Up @@ -178,4 +171,4 @@ def deleteTask():



ws.mainloop()
ws.mainloop()

0 comments on commit 5ba5075

Please sign in to comment.