I am working on a python Tkinter assignment in which an input box accepts user input and then displays the GPA and student status. Im pretty sure I have this setup wrong and am looking for advice on how to use an If statement to determine student status. Should everything fall under the getStudentStatus function or is it better to have two functions?
import math
from tkinter import *
#calculate student status
def getStudentStatus():
data = float(inputGPA.get())
floatedGPA = (data)
#Print student status
label2 = Label(GPA, text = 'Your GPA is:' ' %.2f' % floatedGPA).grid(row = 3, column = 0)
label3 = Label(GPA, getStanding).grid(row = 4, column = 0)
return
def getStanding():
#Get academic Status
if(data>=3.5):
return("This student is on the Deans List")
elif(data>=2.0):
return("This student is on Acedmic Probation")
else:
return("This student has Regular Standing")
#define window
GPA = Tk()
GPA.title("GPA Tool")
GPA.geometry("200x200")
#define variables
inputGPA = StringVar()
#label for text box
label1 = Label(GPA, text="Enter your GPA: ").grid(row = 0, column = 0)
#entry text box
entry1 = Entry(GPA, textvariable = inputGPA).grid(row = 1, column = 0)
#submit button
button1 = Button(GPA, text="Submit", command=getStudentStatus).grid(row = 2, column = 0)
GPA.mainloop()