Professional Documents
Culture Documents
Pyyyy
Pyyyy
class GradeCalculator:
def __init__(self):
self.window = tk.Tk()
self.window.title("CMSC 437 Calculator")
self.window.geometry("300x180")
self.window.resizable(True, True)
self.window.mainloop()
def calculate(self):
try:
bio_grade = float(self.bio_entry.get())
math_grade = float(self.math_entry.get())
average = (bio_grade + math_grade) / 2
self.result_label.config(text=str(average))
except ValueError:
messagebox.showerror("Error", "The grades are not correct!")
app = GradeCalculator()