Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b9bcfd5

Browse files
Merge pull request avinashkranjan#275 from a-k-r-a-k-r/todolist
updated todo list gui resolved suggestions
2 parents 8f7ed81 + 49e2cec commit b9bcfd5

File tree

6 files changed

+146
-0
lines changed

6 files changed

+146
-0
lines changed

‎ToDo-GUI/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# To-Do App
2+
3+
4+
## Introduction
5+
This project is about creating a ToDo App with simple to use GUI, where the users can add items to their list, remove items and save the list.
6+
7+
8+
9+
## Getting started
10+
In order to run this script, you need to have Python and pip installed on your system. After you're done installing Python and pip, run the following command from your terminal to install the requirements from the same folder (directory) of the project.
11+
```
12+
pip install -r requirements.txt
13+
```
14+
15+
After satisfying all the requirements for the project, Open the terminal in the project folder and run
16+
```
17+
python todo.py
18+
```
19+
or
20+
```
21+
python3 todo.py
22+
```
23+
depending upon the python version. Make sure that you are running the command from the same virtual environment in which the required modules are installed.
24+
25+
26+
![Illustration pic for ToDo App](image/todo.jpg)
27+
28+
Now you are all set to explore the ToDo App. Happy Hacking!!!!!!
29+
30+
31+
## Author
32+
[a-k-r-a-k-r](https://github.com/a-k-r-a-k-r)
33+
34+
35+
## Reporting Bugs
36+
Feel free to report any buys or issues.

‎ToDo-GUI/image/todo.jpg

25.5 KB
Loading[フレーム]

‎ToDo-GUI/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
wheel

‎ToDo-GUI/resource_credits.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Let the creators of the other resources (that are used in our project such as the icon, images,etc..) get their credits for their hardwork.
2+
Let them see how valuable their work is for us.
3+
4+
5+
icon credit : https://iconarchive.com/artist/oxygen-icons.org.html
6+
: https://iconarchive.com/show/oxygen-icons-by-oxygen-icons.org/Actions-view-calendar-list-icon.html
7+

‎ToDo-GUI/todo.ico

174 KB
Binary file not shown.

‎ToDo-GUI/todo.py

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
'''ToDo List GUI'''
2+
import tkinter
3+
from tkinter import END,ANCHOR
4+
count=0
5+
6+
7+
'''Defining root window'''
8+
root=tkinter.Tk()
9+
root.title('ToDo-GUI')
10+
root.iconbitmap('todo.ico')
11+
root.geometry('400x400')
12+
root.resizable(0,0)
13+
14+
15+
'''Define fonts and colors'''
16+
my_font=('Times New Roman',12)
17+
root_color='green'
18+
button_color='#e2cff4'
19+
root.config(bg=root_color)
20+
21+
22+
'''Define functions'''
23+
def add_item():
24+
global count
25+
count=count+1
26+
my_listbox.insert(END,str(count) + ") " + list_entry.get())
27+
list_entry.delete(0,END)
28+
29+
30+
def remove_item():
31+
my_listbox.delete(ANCHOR)
32+
33+
34+
def clear_list():
35+
global count
36+
my_listbox.delete(0,END)
37+
count=0
38+
39+
40+
def save_list():
41+
with open('checklist.txt', 'w') as f:
42+
list_tuple=my_listbox.get(0,END)
43+
for item in list_tuple:
44+
if item.endswith('\n'):
45+
f.write(item)
46+
else:
47+
f.write(item+"\n")
48+
49+
50+
def open_list():
51+
try:
52+
with open('checklist.txt','r') as f:
53+
for line in f:
54+
my_listbox.insert(END,line)
55+
except:
56+
return
57+
58+
59+
'''Defining frames'''
60+
input_frame= tkinter.Frame(root,bg=root_color)
61+
output_frame= tkinter.Frame(root,bg=root_color)
62+
button_frame= tkinter.Frame(root,bg=root_color)
63+
input_frame.pack()
64+
output_frame.pack()
65+
button_frame.pack()
66+
67+
68+
'''Input frame layout'''
69+
list_entry= tkinter.Entry(input_frame,width=35,borderwidth=3,font=my_font)
70+
list_add_button= tkinter.Button(input_frame,text="Add",borderwidth=2,font=my_font,bg=button_color,command=add_item)
71+
list_entry.grid(row=0,column=0,padx=5,pady=5)
72+
list_add_button.grid(row=0,column=1,padx=5,pady=5,ipadx=5)
73+
74+
75+
'''Output frame layout'''
76+
my_scrollbar= tkinter.Scrollbar(output_frame)
77+
my_listbox=tkinter.Listbox(output_frame,height=15,width=45,borderwidth=3,font=my_font,yscrollcommand=my_scrollbar.set)
78+
79+
80+
'''Link scrollbar to listbox'''
81+
my_scrollbar.config(command=my_listbox.yview)
82+
my_listbox.grid(row=0,column=0)
83+
my_scrollbar.grid(row=0,column=1,sticky="NS")
84+
85+
86+
'''Button Frame layout'''
87+
list_remove_button= tkinter.Button(button_frame,text="Remove Item",borderwidth=2,font=my_font,bg=button_color,command=remove_item)
88+
list_clear_button= tkinter.Button(button_frame,text='Clear All',borderwidth=2,font=my_font,bg=button_color,command=clear_list)
89+
save_button= tkinter.Button(button_frame,text='Save List',borderwidth=2,font=my_font,bg=button_color,command=save_list)
90+
quit_button= tkinter.Button(button_frame,text='Quit',borderwidth=2,font=my_font,bg=button_color,command=root.destroy)
91+
list_remove_button.grid(row=0,column=0,padx=2,pady=10)
92+
list_clear_button.grid(row=0,column=1,padx=2,pady=10,ipadx=10)
93+
save_button.grid(row=0,column=2,padx=2,pady=10,ipadx=10)
94+
quit_button.grid(row=0,column=3,padx=2,pady=10,ipadx=25)
95+
96+
97+
'''Open the previous list if available'''
98+
open_list()
99+
100+
101+
'''Run the root window's main loop'''
102+
root.mainloop()\

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /