1
1
import tkinter as tk
2
2
3
- """Create SGPA entries based on the total number of semesters entered by the user."""
4
- def create_sgpa_entries ():
3
+ def create_sgpa_entries (): # Create SGPA entries based on the total number of semesters entered by the user.
5
4
num_semesters = int (num_semesters_entry .get ())
6
5
7
6
for i in range (num_semesters ):
@@ -18,16 +17,15 @@ def create_sgpa_entries():
18
17
create_sgpa_buttons .grid_remove ()
19
18
cgpa_calc .grid (row = num_semesters + 2 , column = 0 , columnspan = 2 , padx = 10 , pady = 5 )
20
19
21
- """Validate the SGPA entries to enable or disable the CGPA calculation button."""
22
- def validate_sgpa_entries ():
20
+
21
+ def validate_sgpa_entries (): # Validate the SGPA entries to enable or disable the CGPA calculation button.
23
22
filled_entries = [entry .get () for entry in sgpa_entries ]
24
23
if all (filled_entries ):
25
24
cgpa_calc .configure (state = "normal" )
26
25
else :
27
26
cgpa_calc .configure (state = "disabled" )
28
27
29
- """It is used to calculate cgpa."""
30
- def calculate_cgpa ():
28
+ def calculate_cgpa (): # It is used to calculate cgpa.
31
29
sgpa_values = [float (sgpa_entry .get ()) for sgpa_entry in sgpa_entries ]
32
30
33
31
total_sgpa = sum (sgpa_values )
@@ -38,8 +36,7 @@ def calculate_cgpa():
38
36
39
37
reset_button .configure (state = "normal" )
40
38
41
- """This is used to reset entries after calcuting Cgpa."""
42
- def reset_entries ():
39
+ def reset_entries (): # This is used to reset entries after calcuting Cgpa.
43
40
for label in sgpa_labels :
44
41
label .destroy ()
45
42
for entry in sgpa_entries :
0 commit comments