11import tkinter as tk
22
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.
54 num_semesters = int (num_semesters_entry .get ())
65
76 for i in range (num_semesters ):
@@ -18,16 +17,15 @@ def create_sgpa_entries():
1817 create_sgpa_buttons .grid_remove ()
1918 cgpa_calc .grid (row = num_semesters + 2 , column = 0 , columnspan = 2 , padx = 10 , pady = 5 )
2019
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.
2322 filled_entries = [entry .get () for entry in sgpa_entries ]
2423 if all (filled_entries ):
2524 cgpa_calc .configure (state = "normal" )
2625 else :
2726 cgpa_calc .configure (state = "disabled" )
2827
29- """It is used to calculate cgpa."""
30- def calculate_cgpa ():
28+ def calculate_cgpa (): # It is used to calculate cgpa.
3129 sgpa_values = [float (sgpa_entry .get ()) for sgpa_entry in sgpa_entries ]
3230
3331 total_sgpa = sum (sgpa_values )
@@ -38,8 +36,7 @@ def calculate_cgpa():
3836
3937 reset_button .configure (state = "normal" )
4038
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.
4340 for label in sgpa_labels :
4441 label .destroy ()
4542 for entry in sgpa_entries :
0 commit comments