Skip to content

Commit 7ff9fee

Browse files
committed
Added a simple Task manager with basic GUI
1 parent f5d5080 commit 7ff9fee

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

Todo_GUi.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
from tkinter import messagebox
2+
import tkinter as tk
3+
4+
# Function to be called when button is clicked
5+
def add_Button():
6+
task=Input.get()
7+
if task:
8+
List.insert(tk.END,task)
9+
Input.delete(0,tk.END)
10+
11+
12+
13+
def del_Button():
14+
try:
15+
task=List.curselection()[0]
16+
List.delete(task)
17+
except IndexError:
18+
messagebox.showwarning("Selection Error", "Please select a task to delete.")
19+
20+
21+
22+
# Create the main window
23+
window = tk.Tk()
24+
window.title("Task Manager")
25+
window.geometry("500x500")
26+
window.resizable(False,False)
27+
window.config(bg="light grey")
28+
29+
# text filed
30+
Input=tk.Entry(window,width=50)
31+
Input.grid(row=0,column=0,padx=20,pady=60)
32+
Input.focus()
33+
34+
# Create the button
35+
add =tk.Button(window, text="ADD TASK", height=2, width=9, command=add_Button)
36+
add.grid(row=0, column=1, padx=20, pady=0)
37+
38+
delete=tk.Button(window,text="DELETE TASK", height=2,width=10,command=del_Button)
39+
delete.grid(row=1,column=1)
40+
41+
# creating list box
42+
List=tk.Listbox(window,width=50,height=20)
43+
List.grid(row=1,column=0)
44+
45+
46+
47+
48+
window.mainloop()

0 commit comments

Comments
 (0)