def consoleChangePassword(): clear() print("CHUNG LING HIGH SCHOOL") print("SCHOOL MANAGEMENT SYSTEM") print("< Console Mode >") print("\nStudent Name: " + storage.getName()) print("Class: " + storage.getClass()) print("\nChange password\n") oldPwd = input("Old Password: "******"New Password: "******"Confirm Password: "******"Warning", "Password and confirmed password are not identical.") consoleChangePassword() elif newPwd == "" and cPwd == "": msg("Warning", "Please input your new password.") consoleChangePassword() elif storage.changePassword(g_sid, oldPwd, newPwd) == 0: print("\nYour password has been successfully changed. Input anything to continue.") input("Input: ") consoleMain(g_sid) else: msg("Warning", "Your old password is incorrect.") consoleChangePassword()
def consoleMain(sid): global g_sid global g_name global g_class g_sid = sid clear() print("CHUNG LING HIGH SCHOOL") print("SCHOOL MANAGEMENT SYSTEM") print("< Console Mode >") print("\nStudent Name: " + storage.getName()) print("Class: " + storage.getClass()) print("\nInput 1 to check exam result.") print("Input 2 to check cocurriculum info.") print("Input 3 to change password.") print("Input 0 to log out.") i = input("Input: ") if i == "0": storage.logout() msg("Info", "Successfully logged out.") loadConsole() elif i == "1": clear() print("CHUNG LING HIGH SCHOOL") print("SCHOOL MANAGEMENT SYSTEM") print("< Console Mode >") print("\nStudent Name: " + storage.getName()) print("Class: " + storage.getClass()) result = storage.getExamResult() print("\nUjian 1: \n") print("BC: " + result[0]) print("BM: " + result[1]) print("BI: " + result[2]) print("MM: " + result[3]) print("SC: " + result[4]) print("ASK: " + result[5]) print("SJ: " + result[6]) print("GE: " + result[7]) print("PM: " + result[8]) print("\nPeperiksaan 1: \n") print("BC: " + result[9]) print("BM: " + result[10]) print("BI: " + result[11]) print("MM: " + result[12]) print("SC: " + result[13]) print("ASK: " + result[14]) print("SJ: " + result[15]) print("GE: " + result[16]) print("PM: " + result[17]) print("PJK: " + result[18]) print("PSV: " + result[19]) print("\nUjian 2: \n") print("BC: " + result[20]) print("BM: " + result[21]) print("BI: " + result[22]) print("MM: " + result[23]) print("SC: " + result[24]) print("ASK: " + result[25]) print("SJ: " + result[26]) print("GE: " + result[27]) print("PM: " + result[28]) print("\nPeperiksaan 2: \n") print("BC: " + result[29]) print("BM: " + result[30]) print("BI: " + result[31]) print("MM: " + result[32]) print("SC: " + result[33]) print("ASK: " + result[34]) print("SJ: " + result[35]) print("GE: " + result[36]) print("PM: " + result[37]) print("PJK: " + result[38]) print("PSV: " + result[39]) print("\nInput anything to continue.") input("Input: ") consoleMain(sid) elif i == "2": clear() print("CHUNG LING HIGH SCHOOL") print("SCHOOL MANAGEMENT SYSTEM") print("< Console Mode ?") print("\nStudent Name: " + storage.getName()) print("Class: " + storage.getClass()) co = storage.getCocurriculum() print("\nName: " + co[0]) print("Category: Pakaian Beruniform") print("Pose: " + co[1]) print("Marks: " + co[2]) print("\nName: " + co[3]) print("Category: Persatuan") print("Pose: " + co[4]) print("Marks: " + co[5]) print("\nName: " + co[6]) print("Category: Sukan / Permainan") print("Pose: " + co[7]) print("Marks: " + co[8]) print("\nInput anything to continue.") input("Input: ") consoleMain(sid) elif i == "3": consoleChangePassword() else: msg("Warning", "Please enter a correct input.") consoleMain(sid)
def changePasswordPage(sid): global window2 # Change Password Page: Event Listener def onBackButtonClicked(): window2.withdraw() mainPage(sid) def onChangeButtonClicked(): oldPwd = entry1.get() newPwd = entry2.get() cPwd = entry3.get() if newPwd != cPwd: msg("Warning", "Password and confirmed password are not identical.") window2.focus_force() elif newPwd == "" and cPwd == "": msg("Warning", "Please input your new password.") window2.focus_force() elif storage.changePassword(sid, oldPwd, newPwd) == 0: msg("Info", "Your password has been successfully changed.") onBackButtonClicked() else: msg("Warning", "Your old password is incorrect.") window2.focus_force() window2 = tkinter.Tk() window2.title("School Management System") window2.geometry("640x480") window2.resizable(False, False) label1 = Label(window2, text="Chung Ling High School", font=("Arial Bold", 24)) label1.place(anchor=N, relx=0.5, rely=0.01) label2 = Label(window2, text="SCHOOL MANAGEMENT SYSTEM", font=("Arial", 16)) label2.place(anchor=N, relx=0.5, rely=0.11) label3 = Label(window2, text="Student Name: " + storage.getName() + " Class: " + storage.getClass(), font=("Arial Unicode MS", 12)) label3.place(anchor=W, relx=0.01, rely=0.21) button1 = Button(window2, text="Back", command=onBackButtonClicked, font=("Arial Unicode MS", 8)) button1.place(anchor=E, relx=0.99, rely=0.21) label4 = Label(window2, text="Old Password:"******"Arial Unicode MS", 16)) label4.place(anchor=W, relx=0.06, rely=0.31) entry1 = Entry(window2, font=("Arial Unicode MS", 14), show="•", width=32) entry1.place(anchor=E, relx=0.94, rely=0.31) label5 = Label(window2, text="New Password:"******"Arial Unicode MS", 16)) label5.place(anchor=W, relx=0.06, rely=0.41) entry2 = Entry(window2, font=("Arial Unicode MS", 14), show="•", width=32) entry2.place(anchor=E, relx=0.94, rely=0.41) label6 = Label(window2, text="Confirm Password:"******"Arial Unicode MS", 16)) label6.place(anchor=W, relx=0.06, rely=0.51) entry3 = Entry(window2, font=("Arial Unicode MS", 14), show="•", width=32) entry3.place(anchor=E, relx=0.94, rely=0.51) button2 = Button(window2, text="Change", command=onChangeButtonClicked, font=("Arial Unicode MS", 12), width=16, height=2) button2.place(anchor=E, relx=0.89, rely=0.66) window2.bind("<Return>", (lambda e, b=button2: b.invoke())) entry1.focus_set() window2.focus_force() window2.mainloop()
def coPage(sid): global window2 # Cocurriculum Page: Event Listener def onBackButtonClicked(): window2.withdraw() mainPage(sid) window2 = tkinter.Tk() window2.title("School Management System") window2.geometry("960x480") window2.resizable(False, False) label1 = Label(window2, text="Chung Ling High School", font=("Arial Bold", 24)) label1.place(anchor=N, relx=0.5, rely=0.01) label2 = Label(window2, text="SCHOOL MANAGEMENT SYSTEM", font=("Arial", 16)) label2.place(anchor=N, relx=0.5, rely=0.11) label3 = Label(window2, text="Student Name: " + storage.getName() + " Class: " + storage.getClass(), font=("Arial Unicode MS", 12)) label3.place(anchor=W, relx=0.01, rely=0.21) button1 = Button(window2, text="Back", command=onBackButtonClicked, font=("Arial Unicode MS", 8)) button1.place(anchor=E, relx=0.99, rely=0.21) frame1 = Frame(window2) frame1.place(anchor=N, relx=0.5, rely=0.26) label4 = Label(frame1, text="Name", font=("Arial", 12)) label4.grid(row=0, column=0, padx=64) label5 = Label(frame1, text="Category", font=("Arial", 12)) label5.grid(row=0, column=1, padx=64) label6 = Label(frame1, text="Pose", font=("Arial", 12)) label6.grid(row=0, column=2, padx=32) label7 = Label(frame1, text="Marks", font=("Arial", 12)) label7.grid(row=0, column=3, padx=4) co = storage.getCocurriculum() label8 = Label(frame1, text=co[0], font=("Arial", 12)) label8.grid(row=1, column=0, pady=4) label9 = Label(frame1, text="Pakaian Beruniform", font=("Arial", 12)) label9.grid(row=1, column=1, pady=1) label10 = Label(frame1, text=co[1], font=("Arial", 12)) label10.grid(row=1, column=2, pady=1) label11 = Label(frame1, text=co[2], font=("Arial", 12)) label11.grid(row=1, column=3, pady=1) label12 = Label(frame1, text=co[3], font=("Arial", 12)) label12.grid(row=2, column=0, pady=1) label13 = Label(frame1, text="Persatuan", font=("Arial", 12)) label13.grid(row=2, column=1, pady=1) label14 = Label(frame1, text=co[4], font=("Arial", 12)) label14.grid(row=2, column=2, pady=1) label15 = Label(frame1, text=co[5], font=("Arial", 12)) label15.grid(row=2, column=3, pady=1) label16 = Label(frame1, text=co[6], font=("Arial", 12)) label16.grid(row=3, column=0, pady=1) label17 = Label(frame1, text="Sukan/Permainan", font=("Arial", 12)) label17.grid(row=3, column=1, pady=1) label18 = Label(frame1, text=co[7], font=("Arial", 12)) label18.grid(row=3, column=2, pady=1) label19 = Label(frame1, text=co[8], font=("Arial", 12)) label19.grid(row=3, column=3, pady=1) window.bind("<Return>", (lambda e: None)) window2.focus_force() window2.mainloop()
def examPage(sid): global window2 # Exam Result Page: Event Listener def onBackButtonClicked(): window2.withdraw() mainPage(sid) window2 = tkinter.Tk() window2.title("School Management System") window2.geometry("640x480") window2.resizable(False, False) label1 = Label(window2, text="Chung Ling High School", font=("Arial Bold", 24)) label1.place(anchor=N, relx=0.5, rely=0.01) label2 = Label(window2, text="SCHOOL MANAGEMENT SYSTEM", font=("Arial", 16)) label2.place(anchor=N, relx=0.5, rely=0.11) label3 = Label(window2, text="Student Name: " + storage.getName() + " Class: " + storage.getClass(), font=("Arial Unicode MS", 12)) label3.place(anchor=W, relx=0.01, rely=0.21) button1 = Button(window2, text="Back", command=onBackButtonClicked, font=("Arial Unicode MS", 8)) button1.place(anchor=E, relx=0.99, rely=0.21) frame1 = Frame(window2) frame1.place(anchor=N, relx=0.5, rely=0.26) label4 = Label(frame1, text="First Test", font=("Arial", 12)) label4.grid(row=0, column=1, padx=32) label5 = Label(frame1, text="First Exam", font=("Arial", 12)) label5.grid(row=0, column=2, padx=32) label6 = Label(frame1, text="Second Test", font=("Arial", 12)) label6.grid(row=0, column=3, padx=32) label7 = Label(frame1, text="Final Exam", font=("Arial", 12)) label7.grid(row=0, column=4, padx=32) label8 = Label(frame1, text="BC", font=("Arial", 12)) label8.grid(row=1, column=0, pady=1) label9 = Label(frame1, text="BM", font=("Arial", 12)) label9.grid(row=2, column=0, pady=1) label10 = Label(frame1, text="BI", font=("Arial", 12)) label10.grid(row=3, column=0, pady=1) label11 = Label(frame1, text="MM", font=("Arial", 12)) label11.grid(row=4, column=0, pady=1) label12 = Label(frame1, text="SC", font=("Arial", 12)) label12.grid(row=5, column=0, pady=1) label13 = Label(frame1, text="ASK", font=("Arial", 12)) label13.grid(row=6, column=0, pady=1) label14 = Label(frame1, text="SJ", font=("Arial", 12)) label14.grid(row=7, column=0, pady=1) label15 = Label(frame1, text="GE", font=("Arial", 12)) label15.grid(row=8, column=0, pady=1) label16 = Label(frame1, text="PM", font=("Arial", 12)) label16.grid(row=9, column=0, pady=1) label17 = Label(frame1, text="PJK", font=("Arial", 12)) label17.grid(row=10, column=0, pady=1) label18 = Label(frame1, text="PSV", font=("Arial", 12)) label18.grid(row=11, column=0, pady=1) result = storage.getExamResult() for x in range(9): labelResult = Label(frame1, text=result[x], font=("Arial", 12)) labelResult.grid(row=x + 1, column=1, padx=32, pady=3) for x in range(11): labelResult = Label(frame1, text=result[x + 9], font=("Arial", 12)) labelResult.grid(row=x + 1, column=2, padx=32, pady=3) for x in range(9): labelResult = Label(frame1, text=result[x + 20], font=("Arial", 12)) labelResult.grid(row=x + 1, column=3, padx=32, pady=3) for x in range(11): labelResult = Label(frame1, text=result[x + 29], font=("Arial", 12)) labelResult.grid(row=x + 1, column=4, padx=32, pady=3) window.bind("<Return>", (lambda e: None)) window2.focus_force() window2.mainloop()
def mainPage(sid): global window # Main Page: Event Listener def onLogOutButtonClicked(): storage.logout() msg("Info", "Successfully logged out.") loginPage() def onExamButtonClicked(): window.withdraw() examPage(sid) def onCoButtonClicked(): window.withdraw() coPage(sid) def onChangePasswordButtonClicked(): window.withdraw() changePasswordPage(sid) window.withdraw() window = tkinter.Tk() window.title("School Management System") window.geometry("640x480") window.resizable(False, False) label1 = Label(window, text="Chung Ling High School", font=("Arial Bold", 24)) label1.place(anchor=N, relx=0.5, rely=0.01) label2 = Label(window, text="SCHOOL MANAGEMENT SYSTEM", font=("Arial", 16)) label2.place(anchor=N, relx=0.5, rely=0.11) label3 = Label(window, text="Student Name: " + storage.getName() + " Class: " + storage.getClass(), font=("Arial Unicode MS", 12)) label3.place(anchor=W, relx=0.01, rely=0.21) button1 = Button(window, text="Log Out", command=onLogOutButtonClicked, font=("Arial Unicode MS", 8)) button1.place(anchor=E, relx=0.99, rely=0.21) frame1 = Frame(window) frame1.place(anchor=N, relx=0.5, rely=0.31) button2 = Button(frame1, text="Check exam result", command=onExamButtonClicked, font=("Arial Unicode MS", 16)) button2.grid(row=0, column=0, pady=3) button3 = Button(frame1, text="Check cocurriculum info", command=onCoButtonClicked, font=("Arial Unicode MS", 16)) button3.grid(row=1, column=0, pady=3) button4 = Button(frame1, text="Change password", command=onChangePasswordButtonClicked, font=("Arial Unicode MS", 16)) button4.grid(row=2, column=0, pady=3) window.bind("<Return>", (lambda e: None)) window.focus_force() window.mainloop()