def sign_out(window): def call_sign_in_window(): window.open_login(window) signOut_icon = Image.open("images/Signout.png") signOut_icon = signOut_icon.resize((35, 35), Image.ANTIALIAS) signOut_image = ImageTk.PhotoImage(signOut_icon) signOut_image.icon = signOut_image signOut_button = Button(window, image=signOut_image, width=50, height=50, command=call_sign_in_window, cursor=get_handcursor()) signOut_button.icon = signOut_icon signOut_button.place(x=400, y=655, width=50, height=50)
def course(window, return_function, teacher, person):#this is going to show the course the teacher is currently teaching clear_window(window) whole_window = Canvas(window, width = 500, height = 700, bg = "#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline = "#006386") whole_window.pack() header_label = Label(window,text = "Courses", fg = "#EBEBE9", font = "Arial 30", bg ="#006386") header_label.place(x = 180, y = 15) teacherName_label = Label(window, text = "Name:", fg = "#006386", font="Arial 10 bold",bg = "#EBEBE9") teacherName_label.place(x=20, y = 100) teacherName_label = Label(window, text = (str(person.fname) + " " + str(person.lname)), fg = "#006386", font="Arial 10 bold",bg = "#EBEBE9") teacherName_label.place(x=120, y = 100) teacher_id_label = Label(window, text = "Teacher ID", fg = "#006386", font="Arial 10 bold",bg = "#EBEBE9") teacher_id_label.place(x=20, y = 130) teacher_id_label = Label(window, text = teacher.teacherID, fg = "#006386", font="Arial 10 bold",bg = "#EBEBE9") teacher_id_label.place(x=120, y = 130) courses_label = Label(window, text = "Course Name",fg = "#e6b800", font="Arial 10 bold",bg ="#006386") courses_label.place(x=25, y = 170,width = 185,height=30) courseID_label = Label(window, text = "Course ID",fg = "#e6b800", font="Arial 10 bold",bg ="#006386") courseID_label.place(x=200, y = 170,width = 110,height=30) study_label = Label(window, text = "Study",fg = "#e6b800", font="Arial 10 bold",bg ="#006386") study_label.place(x=310, y = 170,width = 170,height=30) num_pos_y = 200 courses = teacher.getTeacherCourses() for i in range (len(courses)): course_lab = Button(window, text = courses[i].coursetitle,fg = "#00293c", font = "Arial 10",borderwidth=2,cursor = get_handcursor(),command =partial(courseView_students,window,return_function,teacher,person,courses[i])) course_lab.place(x = 25, y = num_pos_y,width = 185,height=30) courseID_lab = Label(window, text = courses[i].courseID,fg = "#00293c", font = "Arial 10",relief="ridge",borderwidth=2) courseID_lab.place(x = 210 , y = num_pos_y,width = 100,height=30) study = courses[i].getStudy() study_lab = Label(window, text = study.studyname,fg = "#00293c", font = "Arial 10",relief="ridge",borderwidth=2) study_lab.place(x = 310 , y = num_pos_y,width = 170,height=30) num_pos_y += 30 go_back(window, return_function) sign_out(window)
def logIn_screen(window): clear_window(window) academy_logo = Image.open("images/diemen_logo2.png") academy_logo = academy_logo.resize((350, 250), Image.ANTIALIAS) test = ImageTk.PhotoImage(academy_logo) label_logo = Label(image=test) label_logo.image = test label_logo.place(x=80, y=0) username = StringVar() password = StringVar() def input_value(): user_name = username.get() pass_word = password.get() if type( user_name ) == str and user_name != "": #actually this part goes to the db to check username/password print("Username: "******"utf-8") #key = b'pRmgMa8T0INjEAfksaq2aafzoZXEuwKI7wDe4c1F8AY=' #cipher_suite = Fernet(key) #ciphered_text = cipher_suite.encrypt(pass_word) #print("Password: "******"Invalid input", "Incorrect Username/Password") username_label = Label(window, text='Username', font="Arial 10 bold") username_entry = Entry(window, textvariable=username, font="Arial 10") username_label.place(x=130, y=180) username_entry.place(x=207, y=180) password_label = Label(window, text='Password', font="Arial 10 bold") password_entry = Entry(window, textvariable=password, font="Arial 10", show="*") password_label.place(x=130, y=210) password_entry.place(x=207, y=210) submit_button = Button(window, text="Log In", command=input_value, cursor=get_handcursor()) submit_button.place(x=220, y=320, width=70, height=30)
def study_overview_edit(window, return_function, study): clear_window(window) whole_window = Canvas(window, width=500, height=700, bg="#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") whole_window.pack() header_label = Label(window, text="Modify Study", fg="#e6b800", font="Arial 30", bg="#006386") header_label.place(x=140, y=15) study_name = Label(window, text="Title: ", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") study_name.place(x=20, y=93) input_study = Text(window, height=1, width=30, bg="light yellow", highlightbackground="#006386", font="Arial 17") input_study.insert(END, study.studyname) input_study.place(x=70, y=90) show_desc = Label(window, text="Description: ", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") show_desc.place(x=20, y=240) input_text = Text(window, bg="light yellow", highlightbackground="#006386", font="Arial 10") input_text.insert(END, study.description) input_text.place(x=125, y=150, height=220, width=350) language = Label(window, text="Select a language: ", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") language.place(x=20, y=420) get_language = StringVar() selected_language = ttk.Combobox(window, textvariable=get_language, width=7) languages = ["Dutch", "English", "German"] selected_language["value"] = languages selected_language.current(languages.index(study.language)) selected_language.place(x=170, y=420) amout_year = Label(window, text="Amount of Years: ", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") amout_year.place(x=20, y=470) get_total = IntVar() amount_years = [] for i in range(1, 11): amount_years.append(i) total_year = ttk.Combobox(window, textvariable=get_total, width=7) total_year["value"] = amount_years total_year.current(amount_years.index(study.studyyears)) total_year.place(x=170, y=470) def submit_all(): result = askquestion(title="Confirmation", message="Do you want to process?") study.studyname = input_study.get(1.0, "end-1c") study.description = input_text.get(1.0, "end-1c") study.language = get_language.get() study.studyyears = get_total.get() print(study) study.update() if result == "yes": ui.AdminWindowStudies.admin_window_studies( window, return_function) #avoid circular import submit_text = Button(window, text="Submit", font="Arial 10 bold", fg="#006386", highlightbackground="#48C9B0", height=2, width=6, command=submit_all, cursor=get_handcursor()) submit_text.place(x=200, y=550) go_back(window, return_function) sign_out(window)
def createNew_teacher(window, return_function): clear_window(window) whole_window = Canvas(window, width = 500, height = 700, bg = "#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline = "#006386") whole_window.pack() header_label = Label(window,text = "Teacher Overview", fg = "#e6b800", font = "Arial 30", bg ="#006386") header_label.place(x = 110, y = 15) lastname_label = Label(window,text = "Lastname", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") lastname_label.place(x = 20, y = 100) input_lastname = Text(window, height = 1, width = 14, bg = "light yellow", highlightbackground = "#006386", font = "Arial 13") input_lastname.place(x=100, y = 100) firstname_label = Label(window,text = "Firstname", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") firstname_label.place(x = 250, y = 100) input_firstname = Text(window, height = 1, width = 14, bg = "light yellow", highlightbackground = "#006386", font = "Arial 13") input_firstname.place(x=330, y = 100) teacherID_label = Label(window,text = "Teacher ID", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") teacherID_label.place(x = 20, y = 130) input_teacherID = Text(window, height = 1, width = 14, bg = "light yellow", highlightbackground = "#006386", font = "Arial 13") input_teacherID.place(x=100, y = 130) salary_label = Label(window,text = "Salary", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") salary_label.place(x = 250, y = 130) input_salary = Text(window, height = 1, width = 14, bg = "light yellow", highlightbackground = "#006386", font = "Arial 13") input_salary.place(x=330, y = 130) selected_counsellor = StringVar() counsellors = ["Yes", "No"] counsellor_sh = ttk.Combobox(window,textvariable = selected_counsellor,width = 4) counsellor_sh["value"] = counsellors counsellor_sh["state"] = "readonly" def counsellor_changed (event): confirm_msg = f"You Selected {counsellor_sh.get()}!" showinfo(title="Result", message= confirm_msg) counsellor_sh.bind("<<ComboboxSelected>>", counsellor_changed) counsellor_sh.place(x = 120, y = 160) studentCounsellor_label = Label(window, text = "Student Counsellor",fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9" ) studentCounsellor_label.place(x = 20, y = 160) personal_label = Label(window,text = "Personal Detail", fg = "#e6b800", font = "Arial 18 bold", bg ="#006386") personal_label.place(x = 20, y = 240) birthYear = IntVar() birth_year = [] for i in range(1950,2011): birth_year.append(i) birth_year_ch = ttk.Combobox(window,textvariable = birthYear, width = 7) birth_year_ch["value"] = birth_year birth_year_ch["state"] = "readonly" def birth_year_choose (event): confirm_msg = f"You Selected {birth_year_ch.get()}!" showinfo(title="Result", message= confirm_msg) birth_year_ch.bind("<<ComboboxSelected>>", birth_year_choose) birth_year_ch.place(x = 210, y = 290) birthMonth = StringVar() months = [ "January", "February", "March", "April", "May", "June", "July", "August", "Septembr", "October", "November", "December" ] birth_month_ch = ttk.Combobox(window,textvariable = birthMonth, width = 10) birth_month_ch["value"] = months birth_month_ch["state"] = "readonly" birth_month_ch.place(x = 300, y = 290) def birth_month_choose (event): confirm_msg = f"You Selected {birth_month_ch.get()}!" showinfo(title="Result", message= confirm_msg) birth_month_ch.bind("<<ComboboxSelected>>", birth_month_choose) birthDay = IntVar() birth_day = [] for i in range(1,32): birth_day.append(i) birth_day_ch = ttk.Combobox(window,textvariable = birthDay, width = 3) birth_day_ch["value"] = birth_day birth_day_ch["state"] = "readonly" def birth_day_choose (event): confirm_msg = f"You Selected {birth_day_ch.get()}!" showinfo(title="Result", message= confirm_msg) birth_day_ch.bind("<<ComboboxSelected>>", birth_day_choose) birth_day_ch.place(x = 420, y = 290) dob_label = Label(window,text = "Date of Birth (YY/MM/DD)", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") dob_label.place(x = 20, y = 290) selected_nationality = StringVar() nationalities = ['Afghan', 'Albanian', 'Algerian', 'American', 'Andorran', 'Angolan', 'Antiguans', 'Argentinean', 'Armenian', 'Australian', 'Austrian', 'Azerbaijani', 'Bahamian', 'Bahraini', 'Bangladeshi', 'Barbadian', 'Barbudans', 'Batswana', 'Belarusian', 'Belgian', 'Belizean', 'Beninese', 'Bhutanese', 'Bolivian', 'Bosnian', 'Brazilian', 'British', 'Bruneian', 'Bulgarian', 'Burkinabe', 'Burmese', 'Burundian', 'Cambodian', 'Cameroonian', 'Canadian', 'Cape Verdean', 'Central African', 'Chadian', 'Chilean', 'Chinese', 'Colombian', 'Comoran', 'Congolese', 'Costa Rican', 'Croatian', 'Cuban', 'Cypriot', 'Czech', 'Danish', 'Djibouti', 'Dominican', 'Dutch', 'Dutchman', 'Dutchwoman', 'East Timorese', 'Ecuadorean', 'Egyptian', 'Emirian', 'Equatorial Guinean', 'Eritrean', 'Estonian', 'Ethiopian', 'Fijian', 'Filipino', 'Finnish', 'French', 'Gabonese', 'Gambian', 'Georgian', 'German', 'Ghanaian', 'Greek', 'Grenadian', 'Guatemalan', 'Guinea-Bissauan', 'Guinean', 'Guyanese', 'Haitian', 'Herzegovinian', 'Honduran', 'Hungarian', 'I-Kiribati', 'Icelander', 'Indian', 'Indonesian', 'Iranian', 'Iraqi', 'Irish', 'Israeli', 'Italian', 'Ivorian', 'Jamaican', 'Japanese', 'Jordanian', 'Kazakhstani', 'Kenyan', 'Kittian and Nevisian', 'Kuwaiti', 'Kyrgyz', 'Laotian', 'Latvian', 'Lebanese', 'Liberian', 'Libyan', 'Liechtensteiner', 'Lithuanian', 'Luxembourger', 'Macedonian', 'Malagasy', 'Malawian', 'Malaysian', 'Maldivan', 'Malian', 'Maltese', 'Marshallese', 'Mauritanian', 'Mauritian', 'Mexican', 'Micronesian', 'Moldovan', 'Monacan', 'Mongolian', 'Moroccan', 'Mosotho', 'Motswana', 'Mozambican', 'Namibian', 'Nauruan', 'Nepalese', 'Netherlander', 'New Zealander', 'Ni-Vanuatu', 'Nicaraguan', 'Nigerian', 'Nigerien', 'North Korean', 'Northern Irish', 'Norwegian', 'Omani', 'Pakistani', 'Palauan', 'Panamanian', 'Papua New Guinean', 'Paraguayan', 'Peruvian', 'Polish', 'Portuguese', 'Qatari', 'Romanian', 'Russian', 'Rwandan', 'Saint Lucian', 'Salvadoran', 'Samoan', 'San Marinese', 'Sao Tomean', 'Saudi', 'Scottish', 'Senegalese', 'Serbian', 'Seychellois', 'Sierra Leonean', 'Singaporean', 'Slovakian', 'Slovenian', 'Solomon Islander', 'Somali', 'South African', 'South Korean', 'Spanish', 'Sri Lankan', 'Sudanese', 'Surinamer', 'Swazi', 'Swedish', 'Swiss', 'Syrian', 'Taiwanese', 'Tajik', 'Tanzanian', 'Thai', 'Togolese', 'Tongan', 'Trinidadian or Tobagonian', 'Tunisian', 'Turkish', 'Tuvaluan', 'Ugandan', 'Ukrainian', 'Uruguayan', 'Uzbekistani', 'Venezuelan', 'Vietnamese', 'Welsh', 'Yemenite', 'Zambian', 'Zimbabwean'] nationality = ttk.Combobox(window,textvariable = selected_nationality,width = 15) nationality["value"] = nationalities nationality["state"] = "readonly" def nationality_changed (event): confirm_msg = f"You Selected {nationality.get()}!" showinfo(title="Result", message= confirm_msg) nationality.bind("<<ComboboxSelected>>", nationality_changed) nationality.place(x = 120, y = 320) studentCounsellor_label = Label(window, text = "Nationality",fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9" ) studentCounsellor_label.place(x = 20, y = 320) selected_gender = StringVar() genders = ["M","F","O"] gender_sh = ttk.Combobox(window,textvariable = selected_gender,width = 10) gender_sh["value"] = genders gender_sh["state"] = "readonly" def counsellor_changed (event): confirm_msg = f"You Selected {gender_sh.get()}!" showinfo(title="Result", message= confirm_msg) gender_sh.bind("<<ComboboxSelected>>", counsellor_changed) gender_sh.place(x = 100, y = 350) studentCounsellor_label = Label(window, text = "Gender",fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9" ) studentCounsellor_label.place(x = 20, y = 350) houseNo_label = Label(window,text = "House No.", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") houseNo_label.place(x = 20, y = 380) input_houseNo = Text(window, height = 1, width = 5, bg = "light yellow", highlightbackground = "#006386", font = "Arial 13") input_houseNo.place(x=100, y = 380) input_houseNo2 = Text(window, height = 1, width = 3, bg = "light yellow", highlightbackground = "#006386", font = "Arial 13") input_houseNo2.place(x=160, y = 380) street_label = Label(window,text = "Street", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") street_label.place(x = 210, y = 380) input_street = Text(window, height = 1, width = 20, bg = "light yellow", highlightbackground = "#006386", font = "Arial 13") input_street.place(x=270, y = 380) city_label = Label(window,text = "City", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") city_label.place(x = 20, y = 410) input_city = Text(window, height = 1, width = 20, bg = "light yellow", highlightbackground = "#006386", font = "Arial 13") input_city.place(x=70, y = 410) postal_label = Label(window,text = "Postal Code", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") postal_label.place(x = 270, y = 410) input_postal = Text(window, height = 1, width = 6, bg = "light yellow", highlightbackground = "#006386", font = "Arial 13") input_postal.place(x=360, y = 410) input_postal2 = Text(window, height = 1, width = 3, bg = "light yellow", highlightbackground = "#006386", font = "Arial 13") input_postal2.place(x=430, y = 410) phoneNumber_label = Label(window,text = "Phone Number", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") phoneNumber_label.place(x = 20, y = 440) input_phoneNumber = Text(window, height = 1, width = 15, bg = "light yellow", highlightbackground = "#006386", font = "Arial 13") input_phoneNumber.place(x=140, y = 440) email_label = Label(window,text = "Email", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") email_label.place(x = 20, y = 470) input_email = Text(window, height = 1, width = 15, bg = "light yellow", highlightbackground = "#006386", font = "Arial 13") input_email.place(x=80, y = 470) def submit_all(): result = askquestion(title="Confirmation", message= "Do you want to process?") if result == "yes": person = Person() person.lname = input_lastname.get(1.0, "end-1c") person.fname = input_firstname.get(1.0, "end-1c") person.birthday = datetime.date(birthYear.get(), months.index(birthMonth.get()) + 1, birthDay.get()) person.nationality = selected_nationality.get() person.gender = selected_gender.get() person.streetNumber = str(input_houseNo.get(1.0, "end-1c")) + str(input_houseNo2.get(1.0, "end-1c")) person.streetname = input_street.get(1.0, "end-1c") person.city = input_city.get(1.0, "end-1c") person.postalCode = str(input_postal.get(1.0, "end-1c")) + str(input_postal2.get(1.0, "end-1c")) person.phone = input_phoneNumber.get(1.0, "end-1c") person.email = input_email.get(1.0, "end-1c") person.insert() teacher = Teacher() teacher.personID = person.personID teacher.salary = input_salary.get(1.0, "end-1c") person.userName = (person.lname + str(teacher.teacherID)) person.userPass = "******" person.update() get_counsellor = selected_counsellor.get() if (get_counsellor == "Yes"): teacher.studycouncelor = 'Y' else: teacher.studycouncelor = 'N' teacher.insert() ui.AdminWindowTeachers.admin_window_teachers(window, return_function) #avoid circular import submit_text = Button(window, text = "Submit",font = "Arial 14 bold",fg = "#006386",highlightbackground ="#48C9B0",height = 2, width = 6, command =submit_all,cursor = get_handcursor()) submit_text.place(x=200, y = 530) go_back(window, return_function) sign_out(window)
def view_students(window, return_function, study): clear_window(window) whole_window = Canvas(window, width=500, height=700, bg="#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") whole_window.pack() header_label = Label(window, text="Study Overview", fg="#e6b800", font="Arial 30", bg="#006386") header_label.place(x=140, y=15) title_label = Label(window, text="Study: ", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") title_label.place(x=20, y=100) study_label = Label(window, text=study.studyname, fg="#006386", font="Arial 16 bold", bg="#EBEBE9") study_label.place(x=120, y=100) add_student = Button(window, text="Add + ", fg="#006386", font="Arial 10 bold", cursor=get_handcursor(), highlightbackground="#006386", command=partial(view_students_add, window, return_function, study)) add_student.place(x=400, y=100) student_name_label = Label(window, text="Lastname Firstname", fg="#e6b800", font="Arial 10 bold", bg="#006386") student_name_label.place(x=20, y=140, width=250, height=30) student_id_label = Label(window, text="Student ID", fg="#e6b800", font="Arial 10 bold", height=1, width=13, bg="#006386") student_id_label.place(x=270, y=140, width=100, height=30) action_label = Label(window, text="Action", fg="#e6b800", font="Arial 10 bold", height=1, width=10, bg="#006386") action_label.place(x=370, y=140, width=100, height=30) num_pos_y = 166 y_position = 168 students = study.getStudentsEnrolledInStudy() for i in range(len(students)): person = students[i].getPerson() lastName_label = Label(window, text=person.fname + " " + person.lname, fg="#00293c", font="Arial 10", relief="ridge", borderwidth=2) lastName_label.place(x=20, y=num_pos_y, width=250, height=30) studentID_label = Label(window, text=students[i].studentID, fg="#00293c", font="Arial 10", relief="ridge", borderwidth=2) studentID_label.place(x=270, y=num_pos_y, width=100, height=30) bg_label = Label(window, relief="ridge", borderwidth=2) bg_label.place(x=370, y=num_pos_y, width=100, height=30) def confirm_deletion(student): result = askquestion(title="Confirmation", message="Do you want to delete this data?") if result == "yes": student.enrolled = None student.update() view_students(window, return_function, study) delete_button = Button(window, text="Delete", font="Arial 10", fg="#006386", highlightbackground="#ffcccc", bg="#ffcccc", cursor=get_handcursor(), height=1, width=5, relief=FLAT, command=partial(confirm_deletion, students[i])) delete_button.place(x=400, y=y_position) num_pos_y += 30 y_position += 30 go_back(window, return_function) sign_out(window)
def admin_window_students(window,return_function): clear_window(window) whole_window = Canvas(window, width = 500, height = 700, bg = "#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline = "#006386") whole_window.pack() header_label = Label(window,text = "An Overview", fg = "#e6b800", font = "Arial 30", bg ="#006386") header_label.place(x = 150, y = 15) create_data_text = Button(text = "+ Create new data", fg = "#e6b800", font="Arial 12 bold", bg = "#2F4F4F", width = 15, cursor = get_handcursor(), highlightbackground = "#006386", command = partial(createNew_student,window,return_function)) create_data_text.place(x=10, y = 80, height = 40) header_label1 = Label(window, text = "#",fg = "#e6b800", font="Arial 13 bold",bg ="#006386") header_label1.place(x=10, y = 125, width=30, height=30) header_label2 = Label(window, text = "Lastname",fg = "#e6b800", font="Arial 13 bold", bg ="#006386") header_label2.place(x=40,y = 125,width=150, height=30) header_label3 = Label(window, text = "Firstname",fg = "#e6b800", font="Arial 13 bold", width = 15,bg ="#006386" ) header_label3.place(x=180, y = 125, width=150,height=30) header_label4 = Label(window, text = "Action",fg = "#e6b800", font="Arial 13 bold" ,bg ="#006386" ) header_label4.place(x=320, y = 125, width=165, height=30) students = Student.load_all() num_pos_y = 158 #initial_num = 0 y_position = 160 for i in range (len(students)): person = students[i].getPerson() number_label = Label(window, text = (i + 1),fg = "#00293c", font = "Arial 13") number_label.place(x = 10, y = num_pos_y,width=30, height=30) #initial_num += 1 last_name_label = Label(window, text = person.lname,fg = "#00293c", font = "Arial 13") last_name_label.place(x = 40, y = num_pos_y,width=150, height=30) first_name_label = Label(window, text = person.fname,fg = "#00293c", font = "Arial 13") first_name_label.place(x = 180 , y = num_pos_y,width=150, height=30) bg_label = Label(window) bg_label.place(x=320, y= num_pos_y, width = 165, height=30) num_pos_y += 30 view_button = Button(window, text = "View",font = "Arial 10", fg = "#006386",bg = "#ccd9ff",highlightbackground = "#ccd9ff",cursor = get_handcursor(), height = 1,width = 4, relief = FLAT,command = partial(student_view, window, return_function, students[i], person)) view_button.place(x= 330, y = y_position, height=26) edit_button = Button(window, text = "Edit",font = "Arial 10", fg = "#006386",bg = "#fff2cc",highlightbackground = "#fff2cc",cursor = get_handcursor(), height = 1,width = 4, relief = FLAT, command = partial(student_edit, window, return_function,students[i], person)) edit_button.place(x= 380, y = y_position, height=26) def confirm_deletion(student): result = askquestion(title="Delete Data", message= "Do you want to process?",icon = "warning") if result == "yes": person = student.getPerson() student.delete() person.delete() admin_window_students(window,return_function) delete_button = Button(window, text = "Delete",font = "Arial 10", fg = "#006386",bg = "#ffcccc",highlightbackground = "#ffcccc",cursor = get_handcursor(), height = 1,width = 5, relief = FLAT, command = partial(confirm_deletion, students[i])) delete_button.place(x= 430, y = y_position, height=26) y_position += 30 go_back(window, return_function) sign_out(window)
def add_remove_courses(window, return_function, teacher, person): clear_window(window) whole_window = Canvas(window, width=500, height=700, bg="#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") whole_window.pack() header_label = Label(window, text="Teacher Overview", fg="#e6b800", font="Arial 30", bg="#006386") header_label.place(x=100, y=15) teacherName_label = Label(window, text="TeacherName", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") teacherName_label.place(x=20, y=100) teacherName = Label(window, text=(str(person.fname) + " " + str(person.lname)), fg="#006386", font="Arial 10 bold", bg="#EBEBE9") teacherName.place(x=120, y=100) teacher_id_label = Label(window, text="Teacher ID", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") teacher_id_label.place(x=20, y=130) teacher_id = Label(window, text=teacher.teacherID, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") teacher_id.place(x=120, y=130) num_pos_y = 180 num_pos_y2 = 210 studies = Study.load_all() studynames = [] for s in studies: studynames.append(s.studyname) courses_ini = [] study_ini = [] for i in range(5): selected_study = Label(window, text="Select Study", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") selected_study.place(x=20, y=num_pos_y) selected_study = StringVar() study_ch = ttk.Combobox(window, textvariable=selected_study) study_ch["value"] = studynames study_ch["state"] = "readonly" study_ch.place(x=150, y=num_pos_y) study_ini.append(study_ch) def study_changed(index, course_ch, event): # update the courses combobox selected_study_name = study_ini[index].get() study_idx = studynames.index(selected_study_name) study_courses = studies[study_idx].getCoursesInStudy() course_names = [] for c in study_courses: course_names.append(c.coursetitle) course_ch["value"] = course_names confirm_msg = f"You Selected {selected_study_name}!" showinfo(title="Result", message=confirm_msg) num_pos_y += 70 select_coures = Label(window, text="Select Course", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") select_coures.place(x=20, y=num_pos_y2) selected_course = StringVar() courses_ch = ttk.Combobox(window, textvariable=selected_course) courses_ch["value"] = [] courses_ch["state"] = "readonly" courses_ch.place(x=150, y=num_pos_y2) courses_ini.append(courses_ch) study_ini[i].bind("<<ComboboxSelected>>", partial(study_changed, i, courses_ch)) def course_changed(index, event): confirm_msg = f"You Selected {courses_ini[index].get()}!" showinfo(title="Result", message=confirm_msg) courses_ini[i].bind("<<ComboboxSelected>>", partial(course_changed, i)) num_pos_y2 += 70 def submit_all(): result = askquestion(title="Confirmation", message="Do you want to process?") #get_study = selected_study.get() #get_course = selected_course.get() if result == "yes": for i in range(5): selected_study_name = study_ini[i].get() selected_course_name = courses_ini[i].get() if selected_study_name != '' and selected_course_name != '': study_idx = studynames.index(selected_study_name) study_courses = studies[study_idx].getCoursesInStudy() for c in study_courses: if selected_course_name == c.coursetitle: c.teacherID = teacher.teacherID c.update() ui.AdminWindowTeacherAddEditCourses.teacher_edit_courses( window, return_function, teacher, person) #avoid circular import submit_text = Button(window, text="Submit", font="Arial 14 bold", fg="#006386", highlightbackground="#48C9B0", height=1, width=6, command=submit_all, cursor=get_handcursor()) submit_text.place(x=200, y=550) go_back(window, return_function) sign_out(window)
def student_personal_counsellor(window, return_function, student): #this is going to show personal data clear_window(window) upper_window = Canvas(window, width=500, height=700, bg="#EBEBE9") upper_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") upper_window.pack() header_label = Label(window, text="Student Counsellor", fg="#EBEBE9", font="Arial 30", bg="#006386") header_label.place(x=100, y=15) explanation_label = Label( window, text= "You can contact us for a confidential conversation to help you with support,\nadvice and information on the following matters.", fg="#006386", font="Arial 10", bg="#EBEBE9", justify="left") explanation_label.place(x=10, y=90) special_circumstances_button = Button(window, text="Special Circumstances", fg="#1f3d7a", font="Arial 10 bold", height=1, width=25, cursor=get_handcursor(), command=partial( contact_counsellor, window, return_function, student)) special_circumstances_button.place(x=50, y=150) special_circumstances_label = Label( window, text= "-Family Circumstance \n-Illness \n-Study Delay \n-Registration and Deregistration", fg="#006386", font="Arial 10", bg="#EBEBE9", justify="left") special_circumstances_label.place(x=50, y=210) financial_problem_button = Button(window, text="Financial Problems", fg="#1f3d7a", font="Arial 10 bold", height=1, width=25, cursor=get_handcursor(), command=partial(contact_counsellor, window, return_function, student)) financial_problem_button.place(x=50, y=300) financial_problem_label = Label( window, text= "-Applying for financial compensation in case of study delay \n-When you are not (or no longer) eligible for student finance \nand loans provided by the Dutch government or need advice \nor information about their student finance", fg="#006386", font="Arial 10", bg="#EBEBE9", justify="left") financial_problem_label.place(x=50, y=360) disability_button = Button( window, text="Study with a Disability or a Chronic Illness", fg="#1f3d7a", font="Arial 10 bold", height=1, width=35, cursor=get_handcursor(), command=partial(contact_counsellor, window, return_function, student)) disability_button.place(x=50, y=455) disability_label = Label( window, text= "-Studying with a disability \n-Applying for educational facilities due to a physical/mental illness ", fg="#006386", font="Arial 10", bg="#EBEBE9", justify="left") disability_label.place(x=50, y=510) go_back(window, return_function) sign_out(window)
def view_courses_add(window, return_function,student): clear_window(window) whole_window = Canvas(window, width = 500, height = 700, bg = "#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline = "#006386") whole_window.pack() header_label = Label(window,text = "Study Overview", fg = "#e6b800", font = "Arial 30", bg ="#006386") header_label.place(x = 140, y = 15) title_label = Label(window,text = "Course", fg = "#006386", font = "Arial 12 bold", bg ="#EBEBE9") title_label.place(x = 20, y = 100) selected_course = StringVar() study = student.getStudy() courses = [] if study != None: courses = study.getCoursesInStudy() coursenames = [] for c in courses: coursenames.append(c.coursetitle) course_ch = ttk.Combobox(window,textvariable = selected_course,width = 20) course_ch["value"] = coursenames course_ch["state"] = "readonly" def course_changed (event): confirm_msg = f"You Selected {course_ch.get()}!" showinfo(title="Result", message= confirm_msg) course_ch.bind("<<ComboboxSelected>>", course_changed) course_ch.place(x = 100, y = 100) def submit_data(): get_course = selected_course.get() result = askquestion(title="Confirmation", message= "Do you want to proceed?") if result == "yes": course_idx = coursenames.index(get_course) student.enrollInCourse(courses[course_idx].courseID) ui.AdminWindowStudentEnrolledCourses.enrolledCourses_students(window, return_function, student) submit_text = Button(window, text = "Submit",font = "Arial 14 bold",fg = "#006386",bg="#48C9B0",highlightbackground ="#48C9B0",command =submit_data,cursor = get_handcursor()) submit_text.place(x=180, y = 300, width = 150,height = 30) go_back(window, return_function) sign_out(window)
def student_studyProgress(window, return_function, student, person): #this is going to show personal data clear_window(window) whole_window = Canvas(window, width=500, height=700, bg="#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") whole_window.pack() header_label = Label(window, text="Study Progress", fg="#EBEBE9", font="Arial 30", bg="#006386") header_label.place(x=140, y=15) name_label = Label(window, text="Name", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") name_label.place(x=20, y=100) name_input = Label(window, text=(str(person.fname) + " " + str(person.lname)), fg="#00293c", font="Arial 10", bg="#EBEBE9") name_input.place(x=130, y=100) study_label = Label(window, text="Study", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") study_label.place(x=20, y=130) study = Label(window, text=student.enrolled, fg="#00293c", font="Arial 10", bg="#EBEBE9") study.place(x=130, y=130) study_label = Label(window, text="Start Year", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") study_label.place(x=20, y=160) startYear_info = Label(window, text=student.startYear, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") startYear_info.place(x=130, y=160) totalCredits_label = Label(window, text="Total Credits", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") totalCredits_label.place(x=20, y=190) totalCredits = Label(window, text="240", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") totalCredits.place(x=130, y=190) courses = student.getEnrolledCourses( ) #get total credit/grades from course > passed exam > Y > get credits total_credits = 0 total_grade = 0 for course in courses: exams = course.getExams() for exam in exams: result = exam.getStudentGrade(student.studentID) if result != None and result.passed == 'Y': total_credits += course.credits total_grade += (result.grade * course.credits) break #need to count only 1 exam / course if total_credits == 0: avg_grade = "Average Grade Currently Not Available" avgGP = Label(window, text=avg_grade, fg="red", font="Arial 10 bold", bg="#EBEBE9") avgGP.place(x=170, y=250) else: avg_grade = round((float(total_grade) / total_credits) / 10, 2) avgGP = Label(window, text=str(avg_grade) + " / 10", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") avgGP.place(x=170, y=250) earnedCredits_label = Label(window, text="Earned Credits ", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") earnedCredits_label.place(x=20, y=220) earnedCredits_label = Label(window, text=total_credits, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") earnedCredits_label.place(x=130, y=220) avgGP_label = Label(window, text="Average Grade Point ", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") avgGP_label.place(x=20, y=250) return_course = Button(window, text="Return to Exam Result", fg="#2E4053", font="Arial 12 bold", highlightbackground="#48C9B0", height=1, width=20, borderwidth=2, cursor=get_handcursor(), relief="groove", command=partial( ui.StudentExamResult.student_results, window, return_function, student, person)) return_course.place(x=150, y=550) go_back(window, return_function) sign_out(window)
def courseView_students( window, return_function, teacher, person, course ): #this is going to show the course the teacher is currently teaching clear_window(window) whole_window = Canvas(window, width=500, height=700, bg="#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") whole_window.pack() header_label = Label(window, text="Courses", fg="#EBEBE9", font="Arial 30", bg="#006386") header_label.place(x=180, y=15) teacherName_label = Label(window, text="Name", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") teacherName_label.place(x=20, y=100) name_label = Label(window, text=(str(person.fname) + " " + str(person.lname)), fg="#00293c", font="Arial 10", bg="#EBEBE9") name_label.place(x=120, y=100) teacher_id_label = Label(window, text="Teacher ID", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") teacher_id_label.place(x=20, y=130) teacherID = Label(window, text=teacher.teacherID, fg="#00293c", font="Arial 10", bg="#EBEBE9") teacherID.place(x=120, y=130) courseName_label = Label(window, text="Course Name", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") courseName_label.place(x=20, y=160) cName_label = Label(window, text=course.coursetitle, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") cName_label.place(x=120, y=160) courseID_label = Label(window, text="Course ID", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") courseID_label.place(x=20, y=190) cID_label = Label(window, text=course.courseID, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") cID_label.place(x=120, y=190) credit_label = Label(window, text="Credits", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") credit_label.place(x=270, y=190) cre_label = Label(window, text=course.credits, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") cre_label.place(x=370, y=190) student_name_label = Label(window, text="Student Name", fg="#e6b800", font="Arial 10 bold", bg="#006386") student_name_label.place(x=20, y=220, width=250, height=30) student_id_label = Label(window, text="Student ID", fg="#e6b800", font="Arial 10 bold", bg="#006386") student_id_label.place(x=270, y=220, width=100, height=30) grade_label = Label(window, text="Grade", fg="#e6b800", font="Arial 10 bold", bg="#006386") grade_label.place(x=370, y=220, width=100, height=30) studentIncourse = course.getStudentsInCourse() all_exams = course.getExams() exam = all_exams[0] num_pos_y = 250 grade_point = [] for i in range(len(studentIncourse)): person = studentIncourse[i].getPerson() lastName_label = Label(window, text=(str(person.fname) + " " + str(person.lname)), fg="#00293c", font="Arial 13", relief="ridge", borderwidth=2) lastName_label.place(x=20, y=num_pos_y, width=250, height=30) studentID_label = Label(window, text=studentIncourse[i].studentID, fg="#00293c", font="Arial 13", relief="ridge", borderwidth=2) studentID_label.place(x=270, y=num_pos_y, width=100, height=30) input_grade = Text(window, height=2, width=10, bg="#80DEEA", highlightbackground="#EBEBE9", font="Arial 10 bold", relief=FLAT) input_grade.place(x=370, y=num_pos_y, width=100, height=30) oldResult = exam.getStudentGrade(studentIncourse[i].studentID) if oldResult != None: input_grade.insert(END, oldResult.grade) num_pos_y += 30 grade_point.append(input_grade) return_course = Button(window, text="Return", fg="#2E4053", font="Arial 15 bold", bg="#48C9B0", highlightbackground="#48C9B0", height=1, width=10, borderwidth=2, cursor=get_handcursor(), relief="groove", command=partial(ui.TeacherCourses.course, window, return_function, teacher, person)) return_course.place(x=170, y=650) go_back(window, return_function) sign_out(window)
def teacher_view(window, return_function, teacher, person): clear_window(window) whole_window = Canvas(window, width=500, height=700, bg="#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") whole_window.pack() header_label = Label(window, text="Teacher Overview", fg="#e6b800", font="Arial 30", bg="#006386") header_label.place(x=100, y=15) lastname_label = Label(window, text="Lastname", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") lastname_label.place(x=20, y=100) lastname_info = Label(window, text=person.lname, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") lastname_info.place(x=120, y=100) firstname_label = Label(window, text="Firstname", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") firstname_label.place(x=250, y=100) firstname_info = Label(window, text=person.fname, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") firstname_info.place(x=350, y=100) teacherID_label = Label(window, text="Teacher ID", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") teacherID_label.place(x=20, y=120) teacherID = Label(window, text=teacher.teacherID, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") teacherID.place(x=120, y=120) salary_label = Label(window, text="Salary", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") salary_label.place(x=250, y=120) salary = Label(window, text=teacher.salary, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") salary.place(x=350, y=120) studentCounsellor_label = Label(window, text="Student Counsellor", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") studentCounsellor_label.place(x=20, y=140) studentCounsellor_info = Label(window, text=teacher.studycouncelor, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") studentCounsellor_info.place(x=150, y=140) personal_label = Label(window, text="Personal Detail", fg="#006386", font="Arial 14 bold", bg="#EBEBE9") personal_label.place(x=20, y=210) dob_label = Label(window, text="Date of Birth", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") dob_label.place(x=20, y=240) dob_info = Label(window, text=person.birthday, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") dob_info.place(x=120, y=240) nationality_label = Label(window, text="Nationality", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") nationality_label.place(x=20, y=260) nationality_info = Label(window, text=person.nationality, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") nationality_info.place(x=120, y=260) gender_label = Label(window, text="Gender", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") gender_label.place(x=20, y=280) gender_info = Label(window, text=person.gender, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") gender_info.place(x=120, y=280) address_label = Label(window, text="Address", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") address_label.place(x=20, y=300) address_info = Label(window, text=(str(person.streetname) + " " + str(person.streetNumber)), fg="#006386", font="Arial 10 bold", bg="#EBEBE9") address_info.place(x=120, y=300) address2_label = Label(window, text="Address", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") address2_label.place(x=20, y=320) address2_info = Label(window, text=(str(person.postalCode) + " " + str(person.city)), fg="#006386", font="Arial 10 bold", bg="#EBEBE9") address2_info.place(x=120, y=320) Contact_label = Label(window, text="Contact", fg="#006386", font="Arial 14 bold", bg="#EBEBE9") Contact_label.place(x=20, y=370) phoneNumber_label = Label(window, text="Phone Number", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") phoneNumber_label.place(x=20, y=400) phoneNumber_info = Label(window, text=person.phone, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") phoneNumber_info.place(x=120, y=400) email_label = Label(window, text="Email", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") email_label.place(x=20, y=420) email_info = Label(window, text=person.email, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") email_info.place(x=120, y=420) teachingCourses_button = Button(window, text="View Teaching Courses", fg="#00ace6", font="Arial 14 bold", height=1, width=20, cursor=get_handcursor(), command=partial(teaching_courses, window, return_function, teacher, person)) teachingCourses_button.place(x=140, y=500) go_back(window, return_function) sign_out(window)
def study_over_view(window, return_function, study): clear_window(window) whole_window = Canvas(window, width=500, height=700, bg="#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") whole_window.pack() header_label = Label(window, text="Study Overview", fg="#e6b800", font="Arial 30", bg="#006386") header_label.place(x=140, y=15) title_label = Label(window, text="Title", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") title_label.place(x=20, y=100) title_labelInfo = Label(window, text=study.studyname, fg="#006386", font="Arial 12 bold", bg="#EBEBE9") title_labelInfo.place(x=120, y=100) desc_label = Label(window, text="Description", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") desc_label.place(x=20, y=130) desc_labelInfo = Label(window, text=study.description, fg="#006386", font="Arial 12 bold", bg="#EBEBE9") desc_labelInfo.place(x=120, y=130) language_label = Label(window, text="Language", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") language_label.place(x=20, y=350) language_labelInfo = Label(window, text=study.language, fg="#006386", font="Arial 12 bold", bg="#EBEBE9") language_labelInfo.place(x=120, y=350) duration_label = Label(window, text="Duration", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") duration_label.place(x=20, y=400) duration_labelInfo = Label(window, text=study.studyyears, fg="#006386", font="Arial 12 bold", bg="#EBEBE9") duration_labelInfo.place(x=120, y=400) years_label = Label(window, text="Year(s)", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") years_label.place(x=160, y=400) student_button = Button(window, text="Student Lists", fg="#00ace6", font="Arial 12 bold", height=2, width=10, cursor=get_handcursor(), command=partial(view_students, window, return_function, study)) student_button.place(x=100, y=500) course_button = Button(window, text="Course Lists", fg="#F39C12", font="Arial 12 bold", height=2, width=10, cursor=get_handcursor(), command=partial(view_courses, window, return_function, study)) course_button.place(x=300, y=500) go_back(window, return_function) sign_out(window)
def student_view(window, return_function, student, person): clear_window(window) whole_window = Canvas(window, width = 500, height = 700, bg = "#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline = "#006386") whole_window.pack() header_label = Label(window,text = "Student Overview", fg = "#e6b800", font = "Arial 30", bg ="#006386") header_label.place(x = 120, y = 15) lastname_label = Label(window,text = "Lastname", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") lastname_label.place(x = 20, y = 100) lastname_info = Label(window,text =person.lname, fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") lastname_info.place(x = 140, y = 100) firstname_label = Label(window,text = "Firstname", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") firstname_label.place(x = 250, y = 100) firstname_info = Label(window,text =person.fname , fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") firstname_info.place(x = 350, y = 100) studentID_label = Label(window,text = "Student ID", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") studentID_label.place(x = 20, y = 120) studentID_info = Label(window,text =student.studentID, fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") studentID_info.place(x = 140, y = 120) startYear_label = Label(window,text = "Start Year", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") startYear_label.place(x = 250, y = 120) startYear_info = Label(window,text =student.startYear , fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") startYear_info.place(x = 350, y = 120) study_label = Label(window,text = "Study", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") study_label.place(x = 20, y = 140) study_info = Label(window,text = student.enrolled , fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") study_info.place(x = 140, y = 140) studentCounsellor_label = Label(window,text = "Student Counsellor", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") studentCounsellor_label.place(x = 20, y = 160) councelor = student.getStudentCounsellor() councelperson = councelor.getPerson() studentCounsellor_info = Label(window,text = (councelperson.fname + " " + councelperson.lname), fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") studentCounsellor_info.place(x = 160, y = 160) personal_label = Label(window,text = "Personal Detail", fg = "#006386", font = "Arial 12 bold", bg ="#EBEBE9") personal_label.place(x = 20, y = 210) dob_label = Label(window,text = "Date of Birth", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") dob_label.place(x = 20, y = 240) dob_info = Label(window,text =person.birthday, fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") dob_info.place(x = 140, y = 240) nationality_label = Label(window,text = "Nationality", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") nationality_label.place(x = 20, y = 260) nationality_info = Label(window,text =person.nationality , fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") nationality_info.place(x = 140, y = 260) gender_label = Label(window,text = "Gender", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") gender_label.place(x = 20, y = 280) gender_info = Label(window,text =person.gender, fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") gender_info.place(x = 140, y = 280) address_label = Label(window,text = "Address", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") address_label.place(x = 20, y = 300) address_info = Label(window,text = (str(person.streetname) + " " + str(person.streetNumber)), fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") address_info.place(x = 140, y = 300) address2_label = Label(window,text = "Address", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") address2_label.place(x = 20, y = 320) address2_info = Label(window,text = (str(person.postalCode) + " " + str(person.city)), fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") address2_info.place(x = 140, y = 320) Contact_label = Label(window,text = "Contact", fg = "#006386", font = "Arial 12 bold", bg ="#EBEBE9") Contact_label.place(x = 20, y = 370) phoneNumber_label = Label(window,text = "Phone Number", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") phoneNumber_label.place(x = 20, y = 400) phoneNumber_info = Label(window,text =person.phone , fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") phoneNumber_info.place(x = 140, y = 400) email_label = Label(window,text = "Email", fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") email_label.place(x = 20, y = 420) email_info = Label(window,text = person.email, fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9") email_info.place(x = 140, y = 420) enrollCourses_button = Button(window, text = "View Enrolled Courses",fg = "#00ace6", font="Arial 10 bold",height = 2, width = 18, cursor = get_handcursor(), command = partial(enrolledCourses_students,window, return_function, student)) enrollCourses_button.place(x = 160, y = 500) go_back(window, return_function) sign_out(window)
def admin_window(window): clear_window(window) upper_window = Canvas(window, width = 500, height = 700, bg = "#EBEBE9") upper_window.create_rectangle(0, 0, 500, 210, fill="#e6b800",outline = "#e6b800") admin_logo = ImageTk.PhotoImage(file="images/Admin.png") upper_window.profile_logo = admin_logo upper_window.create_image(250, 100, image=admin_logo) upper_window.create_text(250, 180, fill = "#EBEBE9", font = "Arial 20", text = "Welcome Admin...") upper_window.pack() def open_study_data(): #confidential data window.open_admin_window_studies(window, admin_window) course_pic = Image.open("images/course_admin.png") course_pic = course_pic.resize((63,63), Image.ANTIALIAS) course_image =ImageTk.PhotoImage(course_pic) course_image.icon = course_image course_data = Button(window, image = course_image, command = open_study_data, cursor = get_handcursor()) course_data.place(x=130, y = 250, width = 75, height = 75) course_data_text = Button(text = "Studies", fg = "#006386", font="Arial 18 bold", cursor = get_handcursor(), command = open_study_data) course_data_text.place(x=205, y = 250, width = 170, height = 75) def open_student_data(): #confidential data window.open_admin_window_students(window, admin_window) student_pic = Image.open("images/student_admin.png") student_pic = student_pic.resize((63,63), Image.ANTIALIAS) student_image =ImageTk.PhotoImage(student_pic) student_image.icon = student_image teacher_image = Button(window, image = student_image, command = open_student_data, cursor = get_handcursor()) teacher_image.place(x=130, y = 350, width = 75, height = 75) teacher_data_text = Button(text = "Students", fg = "#00ace6", font="Arial 18 bold", cursor = get_handcursor(), command = open_student_data) teacher_data_text.place(x=205, y = 350, width = 170, height = 75) def open_teacher_data(): #confidential data window.open_admin_window_teachers(window, admin_window) teacher_pic = Image.open("images/teacher_admin.png") teacher_pic = teacher_pic.resize((63,63), Image.ANTIALIAS) teacher_image =ImageTk.PhotoImage(teacher_pic) teacher_image.icon = teacher_image teacher_image = Button(window, image = teacher_image, command = open_teacher_data, cursor = get_handcursor()) teacher_image.place(x=130, y = 450, width = 75, height = 75) teacher_data_text = Button(text = "Teachers", fg = "#1f1f7a", font="Arial 18 bold", cursor = get_handcursor(), command = open_teacher_data) teacher_data_text.place(x=205, y = 450, width = 170, height = 75)
def teacher_window( teacher, person, window): #this is personal, only individual can see the whole detail clear_window(window) upper_window = Canvas(window, width=500, height=700, bg="#e9f7fb") upper_window.create_rectangle(0, 0, 500, 300, fill="#006386") upper_window_text = Label(window, fg="#e6b800", bg="#006386", font="Impact 24", text="Hello Teacher!") upper_window_text.place(x=150, y=25) profile_logo = ImageTk.PhotoImage(file="images/icon.png") upper_window.profile_logo = profile_logo upper_window.create_image(250, 160, image=profile_logo) name_text = Label(window, fg="#e6b800", bg="#006386", font="Arial 13", text=(person.fname + " " + person.lname + "\n" + person.email)) name_text.place(x=150, y=250) upper_window.pack() def open_personal_data(): #confidential data window.open_teacher_personal(window, partial(teacher_window, teacher, person), teacher, person) personal_data_button = Button(window, text="Personal Data", fg="#e6b800", font="Courier 18", bg="#00264d", highlightbackground="#99ccff", bd=2, command=open_personal_data, cursor=get_handcursor()) personal_data_button.place(x=150, y=325, width=200, height=65) def open_course(): #other teachers can see courses window.open_teacher_course(window, partial(teacher_window, teacher, person), teacher, person) course_button = Button(window, text="Courses", fg="#e6b800", font="Courier 18", height=3, width=30, bg="#001a33", highlightbackground="#66ffcc", bd=2, command=open_course, cursor=get_handcursor()) course_button.place(x=150, y=400, width=200, height=65) def open_schedule(): #other teachers can see schedules window.open_teacher_schedule(window, partial(teacher_window, teacher, person)) schedule_button = Button(window, text="Schedule", fg="#e6b800", font="Courier 18", height=3, width=30, bg="#002b80", highlightbackground="#66ffcc", bd=2, command=open_schedule, cursor=get_handcursor()) schedule_button.place(x=150, y=475, width=200, height=65)
def view_students_add(window, return_function, study): clear_window(window) whole_window = Canvas(window, width=500, height=700, bg="#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") whole_window.pack() header_label = Label(window, text="Study Overview", fg="#e6b800", font="Arial 30", bg="#006386") header_label.place(x=140, y=15) title_label = Label(window, text="Study: ", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") title_label.place(x=20, y=100) study_label = Label(window, text=study.studyname, fg="#006386", font="Arial 16 bold", bg="#EBEBE9") study_label.place(x=120, y=100) student_id = Label(window, text="Student ID", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") student_id.place(x=20, y=130) input_id = Text(window, height=1, width=25, bg="light yellow", highlightbackground="#006386", font="Arial 17") input_id.place(x=130, y=130) def submit_data(): get_id = input_id.get(1.0, "end-1c") student = Student() if student.load(get_id) == False: showerror(title="Error", message="Student ID not found!", icon="error") else: result = askquestion(title="Confirmation", message="Do you want to proceed?") if result == "yes": print(get_id) student.enrolled = study.studyname student.update() ui.AdminWindowStudyViewStudents.view_students( window, return_function, study) submit_text = Button(window, text="Submit", font="Arial 14 bold", fg="#006386", bg="#48C9B0", highlightbackground="#48C9B0", command=submit_data, cursor=get_handcursor()) submit_text.place(x=180, y=300, width=150, height=30) go_back(window, return_function) sign_out(window)
def view_courses(window, return_function, study): clear_window(window) whole_window = Canvas(window, width=500, height=700, bg="#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") whole_window.pack() header_label = Label(window, text="Study Overview", fg="#e6b800", font="Arial 30", bg="#006386") header_label.place(x=140, y=15) title_label = Label(window, text="Study: ", fg="#006386", font="Arial 16 bold", bg="#EBEBE9") title_label.place(x=20, y=100) study_label = Label(window, text=study.studyname, fg="#006386", font="Arial 16 bold", bg="#EBEBE9") study_label.place(x=120, y=100) add_course = Button(window, text="Add + ", fg="#006386", font="Arial 12 bold", cursor=get_handcursor(), highlightbackground="#006386", command=partial(view_course_add, window, return_function, study)) add_course.place(x=400, y=100) course_name_label = Label(window, text="Courses", fg="#e6b800", font="Arial 10 bold", bg="#006386") course_name_label.place(x=20, y=140, width=250, height=30) course_id_label = Label(window, text="Course ID", fg="#e6b800", font="Arial 10 bold", bg="#006386") course_id_label.place(x=270, y=140, width=100, height=30) action_label = Label(window, text="Action", fg="#e6b800", font="Arial 10 bold", bg="#006386") action_label.place(x=370, y=140, width=100, height=30) courses = study.getCoursesInStudy() num_pos_y = 167 y_position = 172 for i in range(len(courses)): courseName_label = Button(window, text=courses[i].coursetitle, fg="#00293c", font="Arial 10", height=2, width=25, relief="ridge", borderwidth=2, cursor=get_handcursor(), command=partial(submit_grade_courses, window, return_function, courses[i])) courseName_label.place(x=20, y=num_pos_y, width=250, height=30) courseID_label = Label(window, text=courses[i].courseID, fg="#00293c", font="Arial 10", height=2, width=13, relief="ridge", borderwidth=2) courseID_label.place(x=270, y=num_pos_y, width=100, height=30) bg_label = Label(window, relief="ridge", borderwidth=2) bg_label.place(x=370, y=num_pos_y, width=100, height=30) def confirm_deletion(course): result = askquestion(title="Confirmation", message="Do you want to delete this data?") if result == "yes": exams = course.getExams() for exam in exams: exam.delete() course.delete() view_courses(window, return_function, study) delete_button = Button(window, text="Delete", font="Arial 10", fg="#006386", bg="#ffcccc", highlightbackground="#ffcccc", cursor=get_handcursor(), height=1, width=5, relief=FLAT, command=partial(confirm_deletion, courses[i])) delete_button.place(x=390, y=y_position, width=70, height=20) num_pos_y += 30 y_position += 30 go_back(window, return_function) sign_out(window)
def create_study(window, return_function): clear_window(window) whole_window = Canvas(window, width=500, height=700, bg="#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") whole_window.pack() header_label = Label(window, text="Create New Study", fg="#e6b800", font="Arial 30", bg="#006386") header_label.place(x=100, y=15) study_name = Label(window, text="Title: ", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") study_name.place(x=20, y=93) input_study = Text(window, height=1, width=30, bg="light yellow", highlightbackground="#006386", font="Arial 12") input_study.place(x=70, y=90) show_desc = Label(window, text="Description: ", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") show_desc.place(x=20, y=240) input_text = Text(window, bg="light yellow", highlightbackground="#006386", font="Arial 10") input_text.place(x=125, y=150, height=200, width=350) language = Label(window, text="Select a language: ", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") language.place(x=20, y=420) get_language = StringVar() selected_language = ttk.Combobox(window, textvariable=get_language, width=7) selected_language["value"] = ["Dutch", "English", "German"] selected_language.current(0) selected_language.place(x=170, y=420) """" start_year = Label(window, text = "Start Year: ",fg = "#006386", font = "Arial 10 bold", bg ="#EBEBE9" ) start_year.place(x = 20, y = 450) get_year = IntVar() year = [] for i in range (2015,2031): year.append(i) started_year = ttk.Combobox(window,textvariable = get_year, width = 7) started_year["value"] = year started_year.current(0) started_year.place(x = 110, y = 450) """ amout_year = Label(window, text="Amount of Years: ", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") amout_year.place(x=20, y=450) get_total = IntVar() amount_years = [] for i in range(1, 11): amount_years.append(i) total_year = ttk.Combobox(window, textvariable=get_total, width=7) total_year["value"] = amount_years total_year.current(0) total_year.place(x=160, y=450) def submit_all(): result = askquestion(title="Confirmation", message="Do you want to process?") get_text = input_text.get(1.0, "end-1c") get_study = input_study.get(1.0, "end-1c") lang = get_language.get() #num_year = get_year.get() total_y = get_total.get() print(get_text, get_study, lang, total_y) if result == "yes": study = Study() study.studyname = get_study study.description = get_text study.language = lang study.studyyears = total_y study.insert() ui.AdminWindowStudies.admin_window_studies( window, return_function) #avoid circular import submit_text = Button(window, text="Submit", font="Arial 10 bold", fg="#006386", highlightbackground="#48C9B0", height=2, width=6, command=submit_all, cursor=get_handcursor()) submit_text.place(x=200, y=550) go_back(window, return_function) sign_out(window)
def teacher_edit_courses(window, return_function, teacher, person): clear_window(window) whole_window = Canvas(window, width=500, height=700, bg="#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") whole_window.pack() header_label = Label(window, text="Teacher Overview", fg="#e6b800", font="Arial 30", bg="#006386") header_label.place(x=120, y=15) teacherName_label = Label(window, text="TeacherName", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") teacherName_label.place(x=20, y=100) teacherName = Label(window, text=(str(person.fname) + " " + str(person.lname)), fg="#006386", font="Arial 10 bold", bg="#EBEBE9") teacherName.place(x=120, y=100) teacher_id_label = Label(window, text="Teacher ID", fg="#006386", font="Arial 10 bold", bg="#EBEBE9") teacher_id_label.place(x=20, y=130) teacher_id = Label(window, text=teacher.teacherID, fg="#006386", font="Arial 10 bold", bg="#EBEBE9") teacher_id.place(x=120, y=130) create_data_text = Button(text="Create new data", fg="#e6b800", font="Arial 10 bold", width=15, cursor=get_handcursor(), highlightbackground="#006386", command=partial(add_remove_courses, window, return_function, teacher, person)) create_data_text.place(x=350, y=110, height=30) Courses_label = Label(window, text="Course Name", fg="#e6b800", font="Arial 10 bold", width=20, bg="#006386") Courses_label.place(x=20, y=160, width=150, height=30) CourseID_label = Label(window, text="Course ID", fg="#e6b800", font="Arial 10 bold", width=12, bg="#006386") CourseID_label.place(x=170, y=160, width=100, height=30) study_label = Label(window, text="Study", fg="#e6b800", font="Arial 10 bold", width=20, bg="#006386") study_label.place(x=270, y=160, width=150, height=30) action_label = Label(window, text="Action", fg="#e6b800", font="Arial 10 bold", bg="#006386") action_label.place(x=420, y=160, width=55, height=30) courses = teacher.getTeacherCourses() num_pos_y = 190 y_position = 193 for i in range(len(courses)): course_lab = Label(window, text=courses[i].coursetitle, fg="#00293c", font="Arial 10", width=20, relief="ridge", borderwidth=2) course_lab.place(x=20, y=num_pos_y, width=150, height=30) courseID_label = Label(window, text=courses[i].courseID, fg="#00293c", font="Arial 9", width=12, relief="ridge", borderwidth=2) courseID_label.place(x=170, y=num_pos_y, width=100, height=30) study = courses[i].getStudy() study_lab = Label(window, text=study.studyname, fg="#00293c", font="Arial 10", width=20, relief="ridge", borderwidth=2) study_lab.place(x=270, y=num_pos_y, width=150, height=30) bg_label = Label(window, relief="ridge", borderwidth=2) bg_label.place(x=420, y=num_pos_y, width=55, height=30) def confirm_deletion(course): result = askquestion(title="Delete Data", message="Do you want to process?", icon="warning") if (result == "yes"): course.teacherID = None course.update() teacher_edit_courses(window, return_function, teacher, person) delete_button = Button(window, text="Delete", font="Arial 8", fg="#006386", bg="#ffcccc", highlightbackground="#ffcccc", cursor=get_handcursor(), width=4, relief=FLAT, command=partial(confirm_deletion, courses[i])) delete_button.place(x=435, y=y_position, height=26) y_position += 30 num_pos_y += 30 def submit_edit(): result = askquestion(title="Confirmation", message="Do you want to process?") if result == "yes": ui.AdminWindowTeacherViewTeach.teaching_courses( window, return_function, teacher, person) #avoid circular import submit_text = Button(window, text="Submit", font="Arial 14 bold", fg="#006386", highlightbackground="#48C9B0", height=1, width=6, command=submit_edit, cursor=get_handcursor()) submit_text.place(x=200, y=530) go_back(window, return_function) sign_out(window)
def student_results(window, return_function,student,person): #this is going to show personal grade points clear_window(window) whole_window = Canvas(window, width = 500, height = 700, bg = "#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline = "#006386") whole_window.pack() header_label = Label(window,text = "Results", fg = "#EBEBE9", font = "Arial 30", bg ="#006386") header_label.place(x = 180, y = 15) code_label = Label(window,text = "Course ID", fg = "#00293c", font = "Arial 11 bold", bg ="#e6f2ff", height = 2,width = 12,borderwidth=2, relief="groove") code_label.place(x = 35, y = 120, width= 100,height=30) subject_label = Label(window,text = "Subject", fg = "#00293c", font = "Arial 11 bold", bg ="#e6f2ff", height = 2,width = 22,borderwidth=2, relief="groove") subject_label.place(x = 135, y = 120, width= 235,height=30) exam_label = Label(window,text = "Result", fg = "#00293c", font = "Arial 11 bold", bg ="#e6f2ff", height = 2,width = 12,borderwidth=2, relief="groove") exam_label.place(x = 370, y = 120, width= 100,height=30) id_pos_y = 150 courses = student.getEnrolledCourses() for i in range (len(courses)): courseID_label = Label(window,text = courses[i].courseID, fg = "#00293c", font = "Arial 10", bg ="#e6f2ff", height = 2, width = 12,borderwidth=2, relief="groove") courseID_label.place(x = 35, y = id_pos_y, width= 100,height=30) subject_label = Label(window,text = courses[i].coursetitle, fg = "#00293c", font = "Arial 10", bg ="#e6f2ff", height = 2, width = 22,borderwidth=2, relief="groove") subject_label.place(x = 135, y = id_pos_y, width= 235,height=30) grade_label = Label(window, bg ="#e6f2ff",borderwidth=2, relief="groove") grade_label.place(x = 370, y = id_pos_y, width= 100,height=30) id_pos_y += 30 grades = student.getStudentGrades() id_pos = 150 for i in range (len(grades)): student_grade = grades[i].grade if student_grade >= 55: grade_label = Label(window,text = student_grade, fg = "green", font = "Arial 10", bg ="#e6f2ff",borderwidth=2, relief="groove") grade_label.place(x = 370, y = id_pos, width= 100,height=30) else: grade_label = Label(window,text = student_grade, fg = "red", font = "Arial 10", bg ="#e6f2ff",borderwidth=2, relief="groove") grade_label.place(x = 370, y = id_pos, width= 100,height=30) id_pos += 30 exam_label = Button(window,text = "Study Progress", fg = "#2E4053", font = "Arial 12 bold", highlightbackground ="#48C9B0", height = 1,width = 15,borderwidth=2, relief="groove",cursor = get_handcursor(),command = partial(student_studyProgress,window,return_function,student,person)) exam_label.place(x = 170, y = 550) go_back(window, return_function) sign_out(window)
def view_course_add(window, return_function, study): clear_window(window) whole_window = Canvas(window, width=500, height=700, bg="#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") whole_window.pack() header_label = Label(window, text="Study Overview", fg="#e6b800", font="Arial 30", bg="#006386") header_label.place(x=140, y=15) title_label = Label(window, text="Study: ", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") title_label.place(x=20, y=100) study_label = Label(window, text=study.studyname, fg="#006386", font="Arial 12", bg="#EBEBE9") study_label.place(x=130, y=100) course_title = Label(window, text="Course Title", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") course_title.place(x=20, y=140) input_title = Text(window, bg="light yellow", highlightbackground="#006386", font="Arial 12") input_title.place(x=130, y=140, height=22, width=250) show_desc = Label(window, text="Description", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") show_desc.place(x=20, y=260) input_text = Text(window, bg="light yellow", highlightbackground="#006386", font="Arial 10") #input_text.insert(END,study.description) input_text.place(x=130, y=180, height=220, width=350) #id_student= [12345,22345,32345,42345,52345,1129,992776] def submit_data(): get_title = input_title.get(1.0, "end-1c") get_desc = input_text.get(1.0, "end-1c") result = askquestion(title="Confirmation", message="Do you want to proceed?") if result == "yes": course = Course() course.studyID = study.studyID course.coursetitle = get_title course.description = get_desc course.insert() # for now every course always start with 1 exam exam = Exam() exam.room = 'unknown' exam.resit = 'N' exam.courseID = course.courseID exam.insert() print(get_title, get_desc) ui.AdminWindowStudyViewCourses.view_courses( window, return_function, study) submit_text = Button(window, text="Submit", font="Arial 14 bold", fg="#006386", highlightbackground="#48C9B0", height=1, width=6, command=submit_data, cursor=get_handcursor()) submit_text.place(x=220, y=480) go_back(window, return_function) sign_out(window)
def enrolledCourses_students(window, return_function, student): clear_window(window) whole_window = Canvas(window, width = 500, height = 700, bg = "#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline = "#006386") whole_window.pack() header_label = Label(window,text = "Student Overview", fg = "#e6b800", font = "Arial 30", bg ="#006386") header_label.place(x = 110, y = 15) person = student.getPerson() student_name_label = Label(window, text = "StudentName", fg = "#006386", font="Arial 10 bold",bg = "#EBEBE9") student_name_label.place(x=20, y = 100) student_name_label = Label(window, text = person.fname + " " + person.lname, fg = "#006386", font="Arial 10 bold",bg = "#EBEBE9") student_name_label.place(x=120, y = 100) student_id_label = Label(window, text = "Student ID", fg = "#006386", font="Arial 10 bold",bg = "#EBEBE9") student_id_label.place(x=20, y = 130) student_id_label = Label(window, text = student.studentID, fg = "#006386", font="Arial 10 bold",bg = "#EBEBE9") student_id_label.place(x=120, y = 130) Study_label = Label(window, text = "Study",fg = "#006386", font="Arial 10 bold",bg = "#EBEBE9") Study_label.place(x=20, y = 160) Study_label = Label(window, text = student.getStudy().studyname,fg = "#006386", font="Arial 10 bold",bg = "#EBEBE9") Study_label.place(x=120, y = 160) add_course = Button(window,text = "+Add Courses",fg = "#006386", font = "Arial 10 bold", cursor = get_handcursor(),highlightbackground = "#006386",command = partial(view_courses_add, window, return_function, student)) add_course.place(x = 380, y = 160) Courses_label = Label(window, text = "Course Name",fg = "#e6b800", font="Arial 10 bold",bg ="#006386") Courses_label.place(x=20, y = 200,width=290, height=30) CourseID_label = Label(window, text = "Course ID",fg = "#e6b800", font="Arial 10 bold",bg ="#006386") CourseID_label.place(x=310, y = 200, width=100, height=30) grades_label = Label(window, text = "Grade",fg = "#e6b800", font="Arial 10 bold",bg ="#006386") grades_label.place(x=410, y = 200, width= 70,height=30) courses = student.getEnrolledCourses() grades = student.getStudentGrades() num_pos_y = 230 for i in range (len(courses)): course_label = Label(window, text = courses[i].coursetitle,fg = "#00293c", font = "Arial 10",relief="ridge",borderwidth=2) course_label.place(x=20, y = num_pos_y,width=290, height=30) courseID_label = Label(window, text = courses[i].courseID,fg = "#00293c", font = "Arial 10", relief="ridge",borderwidth=2) courseID_label.place(x=310, y = num_pos_y, width=100, height=30) bg_label = Label(window, relief="ridge",borderwidth=2) bg_label.place(x=410, y = num_pos_y, width= 70,height=30) num_pos_y += 30 num_pos_y = 230 for i in range (len(grades)): grade_label = Label(window,text = grades[i].grade,fg = "#00293c", font = "Arial 10",relief="ridge",borderwidth=2) grade_label.place(x=410, y = num_pos_y, width= 70,height=30) num_pos_y += 30 go_back(window, return_function) sign_out(window)
def submit_grade_courses(window, return_function, course): #controll part def confirm_submit(): has_incorrect_grade = False for g in range(len(grade_point)): text_button = grade_point[g] grade = text_button.get(1.0, "end-1c") if int(grade) < 0 or int(grade) > 100: has_incorrect_grade = True if has_incorrect_grade: showerror(title="Error", message="Invalid Grade Point!", icon="error") else: result = askquestion(title="Confirmation", message="Do you want to confirm?") if result == "yes": exam_id = exam.examID for g in range(len(grade_point)): student_id = studentIncourse[g].studentID currentResult = exam.getStudentGrade(student_id) grade = int(grade_point[g].get(1.0, "end-1c")) if currentResult == None: #no dubplicate grades for the same student / course. >> check db before adding it result = Result() result.grade = grade result.examID = exam_id result.studentID = student_id result.insert() else: currentResult.grade = grade currentResult.update() ui.AdminWindowStudyViewCourses.view_courses( window, return_function, course.getStudy()) #view part clear_window(window) whole_window = Canvas(window, width=500, height=700, bg="#EBEBE9") whole_window.create_rectangle(0, 0, 500, 70, fill="#006386", outline="#006386") whole_window.pack() header_label = Label(window, text="Study Overview", fg="#e6b800", font="Arial 30", bg="#006386") header_label.place(x=140, y=15) title_label = Label(window, text="Course Title ", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") title_label.place(x=20, y=100) title = Label(window, text=course.coursetitle, fg="#006386", font="Arial 12 bold", bg="#EBEBE9") title.place(x=120, y=100) credit_label = Label(window, text="Credits", fg="#006386", font="Arial 12 bold", bg="#EBEBE9") credit_label.place(x=20, y=130) credit = Label(window, text=course.credits, fg="#006386", font="Arial 12 bold", bg="#EBEBE9") credit.place(x=120, y=130) student_name_label = Label(window, text="Student Name", fg="#e6b800", font="Arial 10 bold", bg="#006386") student_name_label.place(x=20, y=180, width=250, height=30) student_id_label = Label(window, text="Student ID", fg="#e6b800", font="Arial 10 bold", bg="#006386") student_id_label.place(x=270, y=180, width=100, height=30) grade_label = Label(window, text="Grade", fg="#e6b800", font="Arial 10 bold", bg="#006386") grade_label.place(x=370, y=180, width=100, height=30) all_exams = course.getExams() exam = all_exams[0] studentIncourse = course.getStudentsInCourse() num_pos_y = 210 grade_point = [] for i in range(len(studentIncourse)): person = studentIncourse[i].getPerson() studentName_label = Label(window, text=str(person.fname) + " " + str(person.lname), fg="#00293c", font="Arial 10", relief="ridge", borderwidth=2) studentName_label.place(x=20, y=num_pos_y, width=250, height=30) studentID_label = Label(window, text=studentIncourse[i].studentID, fg="#00293c", font="Arial 10", relief="ridge", borderwidth=2) studentID_label.place(x=270, y=num_pos_y, width=100, height=30) input_grade = Text(window, height=2, width=10, bg="#80DEEA", highlightbackground="#EBEBE9", font="Arial 10 bold", relief=FLAT) input_grade.place(x=370, y=num_pos_y, width=100, height=30) oldResult = exam.getStudentGrade(studentIncourse[i].studentID) if oldResult != None: input_grade.insert(END, oldResult.grade) num_pos_y += 30 grade_point.append(input_grade) submit_text = Button(window, text="Submit", font="Arial 14 bold", fg="#006386", highlightbackground="#48C9B0", command=confirm_submit, cursor=get_handcursor()) submit_text.place(x=200, y=550, width=120, height=30) go_back(window, return_function) sign_out(window)
def student_window(student, person, window): #this is personal, only individual can see the whole detail clear_window(window) upper_window = Canvas(window, width = 500, height = 700, bg = "#EBEBE9") upper_window.create_rectangle(0, 0, 500, 210, fill="#006386",outline = "#006386") upper_window.create_text(120,30, fill = "#EBEBE9", font = "Arial 28", text = "Hello There!") profile_logo = ImageTk.PhotoImage(file="images/student-w.png") upper_window.profile_logo = profile_logo upper_window.create_image(250, 80, image=profile_logo) upper_window.create_text(250, 180, fill = "#EBEBE9", font = "Arial 10", text = "First_name Last_name \nstudent_number@diemen_academy.nl") upper_window.pack() def open_student_personal_data(): #confidential data window.open_student_personal(window, partial(student_window, student, person),student,person) profile_pic = Image.open("images/removed.png") profile_pic = profile_pic.resize((42,42), Image.ANTIALIAS) personal_image =ImageTk.PhotoImage(profile_pic) personal_image.icon = personal_image personal_data = Button(window, image = personal_image, command = open_student_personal_data, cursor = get_handcursor()) personal_data.place(x=20, y = 300, width = 75, height = 75) personal_data_text = Button(text = "Personal Data", fg = "#1f3d7a", font="Arial 14",command = open_student_personal_data,cursor = get_handcursor()) personal_data_text.place(x=90, y = 300, width = 135, height = 75) def open_course(): window.open_student_course(window,partial(student_window, student, person),student,person) course_pic = Image.open("images/course.png") course_pic = course_pic.resize((42,42), Image.ANTIALIAS) course_image =ImageTk.PhotoImage(course_pic) course_image.icon = course_image course_image_button = Button(window, image = course_image, command = open_course, cursor = get_handcursor()) course_image_button.place(x=20, y = 370,width = 75, height = 75) course_text = Button(window, text = "Courses" , fg = "#1f3d7a" , font="Arial 14", command = open_course, cursor = get_handcursor()) course_text.place(x=90, y = 370,width = 135, height = 75) def open_exam_register():#other teachers can see schedules window.open_exam_registration(window,partial(student_window, student, person),student) exam_pic = Image.open("images/exam_register.png") exam_pic = exam_pic.resize((42,42), Image.ANTIALIAS) exam_image =ImageTk.PhotoImage(exam_pic) exam_image.icon = exam_image exam_image = Button(window, image = exam_image, command = open_exam_register, cursor = get_handcursor()) exam_image.place(x=20, y = 440,width = 75, height = 75) exam_button = Button(window, text = "Examinations", fg = "#1f3d7a",font="Arial 14", command = open_exam_register, cursor = get_handcursor()) exam_button.place(x=90, y = 440,width = 135, height = 75) def open_counsellor(): window.open_student_counsellor(window,partial(student_window, student, person),student) counsellor_pic = Image.open("images/student_counselor.png") counsellor_pic = counsellor_pic.resize((42,42), Image.ANTIALIAS) scounsellor_image =ImageTk.PhotoImage(counsellor_pic) scounsellor_image.icon = scounsellor_image scounsellor_image = Button(window, image = scounsellor_image, command = open_counsellor, cursor = get_handcursor()) scounsellor_image.place(x=253, y = 300,width = 75, height = 75) scounsellor_button = Button(window, text = "Counsellor",fg = "#1f3d7a", font="Arial 14",command = open_counsellor, cursor = get_handcursor()) scounsellor_button.place(x=320, y = 300,width = 135, height = 75) def open_schedule(): window.open_student_schedule(window,partial(student_window, student, person)) schedule_pic = Image.open("images/schedule.png") schedule_pic = schedule_pic.resize((42,42), Image.ANTIALIAS) schedule_image =ImageTk.PhotoImage(schedule_pic) schedule_image.icon = schedule_image schedule_image = Button(window, image = schedule_image, command = open_schedule, cursor = get_handcursor()) schedule_image.place(x=253, y = 370,width = 75, height = 75) schedule_button = Button(window, text = "Schedule",fg = "#1f3d7a", font="Arial 14",command = open_schedule, cursor = get_handcursor()) schedule_button.place(x=320, y = 370,width = 135, height = 75) #schedule_button1 = Button(window, text = "Schedule", highlightbackground = "green",fg = "#191966", font="Courier 18",height = 3,width = 15, command = open_schedule, cursor = get_handcursor()) def open_result(): window.open_student_result(window,partial(student_window, student, person),student,person) examResult_pic = Image.open("images/exam_result.png") examResult_pic = examResult_pic.resize((42,42), Image.ANTIALIAS) examResult_image =ImageTk.PhotoImage(examResult_pic) examResult_image.icon = examResult_image examResult_image = Button(window, image = examResult_image, command = open_result, cursor = get_handcursor()) examResult_image.place(x=253, y = 440,width = 75, height = 75) examResult_button = Button(window, text = "Results",fg = "#1f3d7a", font="Arial 14",height = 2,width = 15, command = open_result, cursor = get_handcursor()) examResult_button.place(x=320, y = 440,width = 135, height = 75)