Skip to content

Commit 4d038af

Browse files
Initial commit with version 1.0
0 parents  commit 4d038af

File tree

2 files changed

+119
-0
lines changed

2 files changed

+119
-0
lines changed

main.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import tkinter as tk
2+
from tkinter import ttk
3+
4+
5+
root = tk.Tk() # Declare the root object
6+
7+
def process():
8+
output = ['' for _ in range(10)]
9+
count = 0
10+
num_subjects = 0
11+
total_mark = 0
12+
for element in entries.subjects:
13+
output[count] = float(entries.subjects[element].get())
14+
if output[count] != -1.0:
15+
num_subjects += 1
16+
total_mark += output[count]
17+
count += 1
18+
agregate = 0
19+
if num_subjects != 0:
20+
agregate = (total_mark / (100 * num_subjects)) * 100
21+
22+
print(output)
23+
print(agregate)
24+
aggregate_marks['entry'].delete(0, 'end')
25+
aggregate_marks['entry'].insert(0, agregate)
26+
27+
28+
root.title('Marks aggregator v1.0') # makes the title of the window
29+
Window_Title = ttk.Label(root, text='Marks aggregator') # Main heading of the window
30+
31+
class entries: # class containng entries for subjects where use inputs data
32+
subjects = {
33+
'english' : ttk.Entry(root),
34+
'dhivehi' : ttk.Entry(root),
35+
'mathematics' : ttk.Entry(root),
36+
'chemistry' : ttk.Entry(root),
37+
'physics' : ttk.Entry(root),
38+
'biology' : ttk.Entry(root),
39+
'marine science' : ttk.Entry(root),
40+
'business' : ttk.Entry(root),
41+
'accounting' : ttk.Entry(root),
42+
'economics' : ttk.Entry(root)
43+
}
44+
45+
class labels: # Class contaning labels for subjects
46+
subjects = {
47+
'english' : ttk.Label(root, text='English'),
48+
'dhivehi' : ttk.Label(root, text='Dhivehi'),
49+
'mathematics' : ttk.Label(root, text='Mathematics'),
50+
'chemistry' : ttk.Label(root, text='Chemistry'),
51+
'physics' : ttk.Label(root, text='Physics'),
52+
'biology' : ttk.Label(root, text='Biology'),
53+
'marine science' : ttk.Label(root, text='Marine Science'),
54+
'business' : ttk.Label(root, text='Business'),
55+
'accounting' : ttk.Label(root, text='Accounting'),
56+
'economics' : ttk.Label(root, text='Economics')
57+
}
58+
59+
aggregate_marks = { # Dictionary containing users agregate marks and its label
60+
'label' : ttk.Label(root, text='Aggregated Mark'),
61+
'entry' : ttk.Entry(root)
62+
}
63+
64+
#aggregate_marks['entry'].config(state='readonly') # Sets aggregatemarks to read only
65+
aggregate_marks['entry'].insert(0, '0') # Sets agregate marks entry value to 0
66+
67+
# sets the positions and arrangement of the entries, and labels
68+
row_count = 1
69+
for element in labels.subjects:
70+
entries.subjects[element].insert(0, '-1')
71+
entries.subjects[element].grid(row=row_count, column=1, padx=10, pady=5)
72+
labels.subjects[element].grid(row=row_count, column=0, padx=10, pady=5)
73+
row_count += 1
74+
column_count = 0
75+
for element in aggregate_marks:
76+
aggregate_marks[element].grid(row=row_count+1, column=column_count, padx=10, pady=5)
77+
column_count += 1
78+
Window_Title.grid(row=0, column=0, columnspan=2)
79+
80+
# sets up the one button
81+
calculate = ttk.Button(root, text='Calculate', command=process)
82+
calculate.grid(row=row_count, column=0, columnspan=2, padx=5, pady=10)
83+
root.mainloop()

readme.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Marks aggregator
2+
3+
Made to be used to calculate marks of subjects and find the average mark of all the subjects
4+
5+
Basic program made in python using tkinter and ttk libraries
6+
7+
Made as a **basic coding project for fun during break times of mine**
8+
9+
## Issues
10+
- Code base is very unclean with many typos and shit
11+
- the output list is init with str when float is being inserted into it
12+
- More sutable variable names should be found and used
13+
- code should be more structured
14+
15+
## compiled binaries
16+
Not avalable yet, this isnt a final product
17+
18+
you should be able to **compile** it using pyinstaller tho to make an executable binary
19+
20+
No, i didnt make it os specific i think
21+
22+
## dependencies
23+
- **Windows**
24+
- Python 3.13 or 3.12 (whatever, it should work with any 3x version, i havnt tested)
25+
> Note: Tkinter comes preinstalled with windows versions of python
26+
- **Linux**
27+
- Fedora
28+
- Install tkinter using `sudo dnf install python3-tkinter`
29+
- Arch
30+
- install tknter using `sudo pacman -S tk`
31+
- ubuntu
32+
- install tkinter using `sudo apt update && sudo apt install python3-tk`
33+
- **MacOS**
34+
- i dont know, i dont own a mac
35+
36+

0 commit comments

Comments
 (0)