0% found this document useful (0 votes)
10 views17 pages

Student Grade Calculator Overview

The document summarizes a student grade calculator application created by four students. It includes an introduction of the group members and their roles. It then describes the key aspects of the application in detail over multiple sections, including importing libraries, creating the main window interface, adding buttons and text boxes, opening a student data input window, saving student data, calculating grades, changing grade requirements, calculating overall class averages, and handling errors. The application allows inputting student grades, calculating grade averages, and viewing class statistics.

Uploaded by

Simon Atkinson
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views17 pages

Student Grade Calculator Overview

The document summarizes a student grade calculator application created by four students. It includes an introduction of the group members and their roles. It then describes the key aspects of the application in detail over multiple sections, including importing libraries, creating the main window interface, adding buttons and text boxes, opening a student data input window, saving student data, calculating grades, changing grade requirements, calculating overall class averages, and handling errors. The application allows inputting student grades, calculating grade averages, and viewing class statistics.

Uploaded by

Simon Atkinson
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

STUDENT GRADE

CALCULATOR
David, Iva, Emil, and Simon
Introduction

- Our group is led by David who strictly held the group on track.
He made sure we started on time, created a group chat, and
got us working. The developers, Simon and Emil, took their
time to make the student grade calculator as efficient as
possible. Finally, our designer, Iva, simplified their work into a
single presentation explaining the processes and details.
First steps - bases and visuals
● First, the library tkinter is imported and
simplified to “tk” for simpler use. Then the
averaging function from the statistics library is
imported.

● “Root” is the main window, which we created,


centered and created a title.

● “Student_avg” and “Student_score” creates a


list to store the student data for later uses.

● We used [Link] as a method to listen


for changes (button presses, keyboard
presses, etc.) and responds to them. We need
it for the window to run. This specifically is
always at the end of the code.
The buttons are aligned
through the widget “button
frame”.

The two text


boxes in
which the
results are
displayed

WHAT THE MAIN WINDOW LOOKS LIKE


● We add three buttons with
different uses -
“add_student_button”,
“submit”button” &
“change_grade_requireme
nts_button”. When clicked
they run another function.
● “[Link]” creates the
button itself. “.pack” then
places it in the window.
● The text boxes are created
through “[Link]”.
● “Student_text” displays the
grades of a given student.
“Output_text” displays the
average of the whole class.
● “Config” is used to prohibit
editing.
● The function
“open_student_window” is used to
open a separate input menu.
● We make sure it’s on top of the
main window with
“[Link](root)”.
● “Label_name” and “Entry_name”
form a label and input box for the
name of a student (repeated for
subjects).
-> to create them we use “[Link]”
& “[Link]” .
● “.pack” places it in the window

● The submit button is used to run the


function to store the data and display it on
the main window.
● We then use
“command=save_student_data” to add a
separate function which saves the data
and also calculates the averages.
Here is a demonstration of how the Student data window
works:
● We attempt “try” to
save the entered
data in variables as
“Floats”. If an error
is detected,
ValueError”, it
reports it and stops
the function.

● We then check to
see it the scores are
from 0-100 and then
calculate the avg
scores and final
grade with the
“calculate_grade”
function.
● An “f” string (a string
that can embed
variables) is made that
contains the scores,
average score (displayed
with 2 decimals - “:.2f”),
and grades on the
student.
● We then allow the text
box to be edited, output
the data, and prohibit
editing again.
● The scores and average
are then stored to a
corresponding list array
for later use.
● The window is then
closed when done -
“[Link]”
● We set the default minimum scores for
each grade.

● We use the “calculate_grade()” function


with the argument “score” which
calculates the grade based on the score
and returns a letter value (A - F).

● This data is then outputted in the main


window.
● This function is
practically the same as
“open_student_window”
with a few differences.
● “Change_grade_require
ments( )” is the function
which changes ● In contrast to the other menu, here we
minimum grade criteria.
add “.config” which sets the width (to 3)
of the input box and “.insert” which sets
default value to be visible.
● For example if A, then 90 will be
displayed.
● This function is also
similar to the
“save_student_data”
function, the only
difference being that the
data is not displayed.

● We also have used the


“global” keyword in order
to declare that the
variables A - F can be
used outside the function.
● With “len” we check the
● We use the length of the array, making
“submit_data” function sure it has data inside of it.
to calculate the If it doesn’t it is considered
general info of all the an error.
students. ● We make sure that any
● The “submit all” button previous text is erased with
runs this function. “.delete”, so that new
variables can be added.
● We calculate the average
and write it in the text box.
Then we only sum the
scores which are over D
and use that value to
calculate the percentage.
● This is then written in the
text box.
● “[Link]” writes the
percentage.
● This function “return_error” reports an ● If “code” equals “0” then there
error to the user. The argument “code” is must’ve been an error saving
used to determine the type of error. scores of a student or changing
the grade requirement.

● And if it is a “1”
(or sth other
than “0”), then
no data was
saved before it
was submitted.
● These
messages pop
up as a separate
window.

You might also like