· 6 years ago · Nov 04, 2019, 09:14 PM
1 #import appropriate libraries from python
2from tkinter import *
3#tkinter allows us to create GUI's
4import csv
5import sys
6#sys allows us to kill the program
7import random
8#allows us to create a random number for the Pupil ID
9import tkinter.simpledialog
10#this library allows us to make messege boxes
11from tkinter import messagebox
12from tkinter import ttk
13import datetime
14import math
15
16#all functions for the program wiil be written here
17####################################################################################################################################
18
19#function name: raise_frame
20#reason: this will raise a particular frame to allow it to be viewed by the user
21#returns: no returns
22#perameter: name of the frame the user want to see
23def raise_frame(frame_name):
24 frame_name.tkraise()
25####################################################################################################################################
26#clear_button
27 #clear username and password
28 #returns: none
29 #parameters: none
30def login_clear_button():
31 username.set("")
32 password.set("")
33####################################################################################################################################
34#login_help
35 #reason
36 #return: none
37 #parameters: none
38
39def login_help():
40 messagebox.showinfo("User informtion", "Please fill in your username and password", icon = "info")
41####################################################################################################################################
42
43 #login_submit
44 #reason: logs the user into the menu
45 #returns:none
46 #parameters:none
47 #look at data thats been entered
48def login_submit():
49 login_username = username.get()
50 login_password = password.get()
51
52 if(login_username == "" or login_password == "" or login_username.isnumeric() == True or login_password.isnumeric() == True):
53 messagebox.showinfo("User information", "Invalid data entered", icon = "warning")
54 username.set
55 #this is the code for a presence check
56
57
58 #access username and password file
59 else:
60 with open("usernamesandpasswords.txt","r") as csvfile:
61
62#making a variable called found to test if its found the record or not
63
64 found = 0
65 reader = csv.reader(csvfile)
66 for row in reader:
67 if(login_username == row[0] and login_password == row[1]):
68 raise_frame(menu_frame)
69 found = 1
70
71 username.set('')
72 password.set('')
73 csvfile.close()
74
75 if(found == 0):
76 messagebox.showinfo("User information", login_username + "does not exist", icon = "error")
77 login_clear_button()
78
79
80def add_pupil_details():
81#.get all the information from the screen
82 afirstname = firstname.get()
83 asurname = surname.get()
84 #.get both parts of the email
85 aemail = email.get()
86 aemailaddress = emailaddress.get()
87 fullemail = aemail + aemailaddress
88 print(fullemail)
89
90 #
91 pup_age=age_spin.get()
92
93 agender_choice = gender_choice.get()
94 #take the mobile data entered
95 amobile = mobile.get()
96 fullmobile = "44" + amobile
97
98#error checking
99 if(afirstname =="" or asurname=="" or aemail=="" or amobile==""):
100 print("Error")
101 messagebox.showerror("Error", "there was an issue with the inputted information")
102 firstname.set("")
103 surname.set("")
104 email.set("")
105 mobile.set("")
106
107 elif(agender_choice > 2):
108 print("Error 2")
109 messagebox.showerror("Error", "Please select a gender")
110 firstname.set("")
111 surname.set("")
112 email.set("")
113 mobile.set("")
114
115 elif(len(fullmobile)!=12):
116 print("Error 3")
117 messagebox.showerror("Error", "the mobile number entered is invalid")
118 firstname.set("")
119 surname.set("")
120 email.set("")
121 mobile.set("")
122
123
124 #confirm that the user wants to save this data
125 else:
126 result = messagebox.askquestion("submit", "You are about to enter the following data\n" + afirstname + "\n" + asurname + "\n" + fullemail + "\n")
127
128 #create unique
129 initial = afirstname[0]
130 id_number = random.randint(100,1000)
131 userid = str(id_number)
132
133 if(result == "yes"):
134 print("here")
135 #opens the usernamesandpasswords file and adds the new data
136 with open("add_details.txt" , "a") as csvfile:
137 writer = csv.writer(csvfile)
138 writer.writerow([userid,afirstname,asurname,fullemail,pup_age,agender_choice,amobile])
139 csvfile.close()
140 messagebox.showinfo("Information", "Your unique ID is " + userid)
141 else:
142 firstname.set("")
143 surname.set("")
144 email.set("")
145 mobile.set("")
146
147
148
149
150def display_ski_times():
151 #create an empty array called ski times
152 skitimesTV = []
153 #open the csv that contains the ski times and the average
154 with open ("skiandadverage.txt", "rU") as csvfile:
155 #place all the data in reader
156 reader = csv.reader(csvfile)
157 #go through reader
158 for row in reader:
159 #add the times into the array called skitimesTV
160 skitimesTV.append(row)
161 csvfile.close()
162 print(SkitimesTV)
163
164 #get all the data in the treeview called TimesTV
165 records = TimesTV.get_children()
166
167 #go through the tv and delete it
168 for elements in records:
169 TimesTV.delete(elements)
170
171 #go throught the data in the array ski times and insert it in the the TimesTV component
172 for row in skitimesTV:
173 TimesTV.insert("","end",text = row[0],values=(row[1],row[2],row[3],row[4],row[5]))
174
175 #create a word document
176 f = open("skitimes.docx","w")
177 #first line of the report
178 f.write("report name: Ski times" +"\n" + "\n")
179 #get the current date
180 now = datetime.datetime.now()
181 #in the document write the date
182 f.write("Date: "+str(now.day) +"/" +str(now.month) + str(now.year) +"\n")
183 #write the headings adding in tab to format this line
184 f.write("Position" + "\t"+"PupilName" +"\t" + "Times" + "\n")
185 f.write("\n")
186 #
187 position = 1
188 #we are going to list the variables
189 for i in skitimesTV:
190
191 #write the value of the position, which say the times
192 f.write(str(position) + "\t" + "\t")
193 #write the student ID
194 f.write(i[0]+ "\t" + "\t")
195 #write the time and move on to the next
196 f.write(i[3] + "\n")
197 f.write("\n")
198 #increase the value by one
199 position = position + 1
200 f.close()
201
202def display_ski_time_W():
203 print("here")
204 ########################################
205#---------------------------------------------------------------------------------------------------------------
206#for the ages report
207
208
209def display_pupil_ages():
210 #create an empty array called ages_report_frame
211 ages_report_frame = []
212 #open the csv that contains the pupil ages
213 with open ("add_details.txt", "rU") as csvfile:
214 #place all the data in reader
215 reader = csv.reader(csvfile)
216 #go through reader
217 for row in reader:
218 #add the times into the array called ages_report_frame
219 ages_report_frame.append(row)
220 csvfile.close()
221 print(ages_report_frame)
222
223 #get all the data in the treeview called AgesTV
224 records = AgesTV.get_children()
225
226 #go through the tv and delete it
227 for elements in records:
228 AgesTV.delete(elements)
229
230 #go throught the data in the array and insert it in the the AgesTV component
231 for row in ages_report_frame:
232 AgesTV.insert("","end",text = row[0],values=(row[1],row[2],row[3],row[4],row[5]))
233
234
235 position = 1
236 #we are going to list the variables
237 for i in age_report_frame:
238
239 #write the value of the position, which say the Ages
240 f.write(str(position) + "\t" + "\t")
241 #write the pupil ID
242 f.write(i[0]+ "\t" + "\t")
243 #write the time and move on to the next
244 f.write(i[3] + "\n")
245 f.write("\n")
246 #increase the value by one
247 position = position + 1
248 f.close()
249
250#--------------------------------------------------------------------------------------
251def help_AgesRep():
252 messagebox.showinfo('Help','Please press the "Ages of the Pupils" button',icon='info')
253
254
255
256
257
258
259
260###############################################################################################################
261#menu_help
262#reason:to assist confused users
263#returns: none
264#parameters: none
265
266def menu_help():
267 messagebox.showinfo("User informtion", "Please select an option from this menu", icon = "info")
268
269#summary1_button
270 #reason:give a summary
271 #returns:none
272 #parameters:none
273def summary1_button():
274 raise_frame(SkitimesTV)
275
276
277#summary2_button
278 #reason:give a summary
279 #returns none
280 #parameters:none
281def summary2_button():
282 raise_frame(age_report_frame)
283
284
285
286#back_menu
287 #reason:to allow the user to go back
288 #returns:none
289 #parameters:none
290def back_menu():
291 raise_frame(login_frame)
292
293#add_pupil
294 #reason:to add pupil lists
295 #returns:none
296 #parameters:none
297def add_pupil():
298 raise_frame(pupilentry_frame)
299
300#pupil_groups
301#reason:easy to understand the skill groups
302#returns:none
303#parameters:none
304def find_student():
305 entered_id=id_pup.get()
306 _entered_slope_time_1=slope_1_time.get()
307 _entered_slope_time_2=slope_2_time.get()
308 _entered_slope_time_3=slope_3_time.get()
309 _entered_slope_time_4=slope_4_time.get()
310 _entered_slope_time_5=slope_5_time.get()
311
312 entered_slope_time_1=int(_entered_slope_time_1)
313 entered_slope_time_2=int(_entered_slope_time_2)
314 entered_slope_time_3=int(_entered_slope_time_3)
315 entered_slope_time_4=int(_entered_slope_time_4)
316 entered_slope_time_5=int(_entered_slope_time_5)
317
318 with open('add_details.txt', 'rU') as csvfile:
319 reader = csv.reader(csvfile)
320 for row in reader:
321 if row ==[]:
322 pass
323 elif row[0] == entered_id:
324 checked_entered_id =entered_id
325 firstname = row[1]
326
327
328 total_time=(entered_slope_time_1+entered_slope_time_2+entered_slope_time_3+entered_slope_time_4+entered_slope_time_5)
329 avg_time=total_time/5
330 with open('time_1.txt', 'a') as csvfile:
331 writer = csv.writer(csvfile)
332 writer.writerow([checked_entered_id,firstname,avg_time])
333 csvfile.close()
334 messagebox.showinfo("Average time", "Average time is "+checked_entered_id, icon = "info")
335
336
337
338
339def back():
340 raise_frame(menu_frame)
341
342def pupil_groups():
343 raise_frame(pupil_groups_frame)
344
345def find_skill_group():
346 Group_choice = Group.get()
347 all_selected=0
348 if Group_choice == 'All':
349 all_selected=1
350
351 #Create an empty array called pupils
352 #I will go through the file and pick out all of these pupils
353 pupils_array = []
354
355 #open the file contains all of the pupils scores
356 with open('skillgroups.txt', 'rU') as csvfile:
357 #place all of the data inside a variable called reader
358 reader = csv.reader(csvfile)
359
360 found_id=0
361 #go through the variable reader
362 for row in reader:
363 #if a row is empty pass by it not causing an error
364 #Solves the list index out of range error
365 if len(row) and row == []:
366 found_id=1
367 pass
368 #compare the pupils group to the group selected
369 if all_selected==0:
370 pupils_array.append(row)
371 if len(row) and row[3] == Group_choice and found_id==0 and all_selected==1:
372 #add the pupils record into the array called student marks
373 pupils_array.append(row)
374
375 if row[3] == Group_choice:
376 pupils_array.append(row)
377 csvfile.close()
378 print(pupils_array)
379
380 #get all of the data from the treeview called TimesTV
381 records = TimesTV.get_children()
382
383 #go through the data in the treeview and delete it
384 for elements in records:
385 hgroupTV.delete(elements)
386
387 #go through the data in the array pupils and insert it into the Treeview component called TimesTV
388 for row in pupils_array:
389 hGroupTV.insert('','end',text = row[0],values=(row[1],row[2], row[3], row[4], row[5], row[6], row[7]))
390
391
392 #We now have the records from the csv file and they have been ordered
393 #We are now going to write this ordered list to a file
394 #We are also going to display all of the results in the Listbox we created
395
396 #Create the word document and open it in write mode
397 f = open("skillgroups.docx", "w")
398 #Write in the first line of the report
399 f.write("Report Name: Pupils" +"\n" + "\n")
400 #Get the current date this contains all the aspect of the date including date and time
401 now = datetime.datetime.now()
402 #In the report document write the date
403 f.write("Date: "+str(now.day) +"/" + str(now.month) + "/" +str(now.year) +"\n")
404 #In the report document write the headings adding in tab to format this line
405 f.write("First Name" +"\t" + "Surname" +"\n")
406 f.write("\n")
407
408 #we are going through the list and the variable i will take on the data in each part of the list as we go through the for loop
409 for i in pupils_array:
410
411 #Write the first name and use tabs to space it out properly
412 f.write(i[0]+ "\t" + "\t")
413 #Write the surname and use new line to move onto the next line in the file
414 f.write(i[1] +"\n")
415 f.write("\n")
416
417 f.close()
418
419#############################################################################################################################
420#def pupil_skill_groupsL2H():
421
422 #Create an empty array called pupils
423 #I will go through the file and places all of the pupils
424 # pupils_array = []
425
426 #open the file contains all of the pupils groups
427 # with open('skillgroups.txt', 'rU') as csvfile:
428 #place all of the data inside a variable called reader
429 # reader = csv.reader(csvfile)
430 #go through the variable reader
431 # for row in reader:
432 #if a row is empty pass by it not causing an error
433 # if row == []:
434 # pass
435 # else:
436 #add the pupils record into the array called skill groups
437# pupils_array.append(row)
438 # csvfile.close()
439 # print(pupils_array)
440
441 #get all of the data from the treeview called TimesTV
442 # records = TimesTV.get_children()
443
444 #go through the data in the treeview and delete it
445 # for elements in records:
446 # TimesTV.delete(elements)
447
448 #we are now going to sort the list based upon the pupils
449# total = lambda pupils_array: pupils_array[4]
450 #we are going to sort the list from biggest to smallest
451# pupils_array.sort(key=total, reverse = True)
452
453 #go through the data in the array golfers and insert it into the Treeview component called scoreTV
454# for row in pupils_array:
455 # TimesTV.insert('','end',text = row[0],values=(row[1],row[2], row[3], row[4], row[5], row[6], row[7]))
456
457 #We now have the records from the csv file and they have been ordered
458 #We are now going to write this ordered list to a file
459 #We are also going to display all of the results in the Listbox we created
460
461 #Create the word document and open it in write mode
462 # f = open("skillgroups.docx", "w")
463 #Write in the first line of the report
464 # f.write("Report Name: pupils" +"\n" + "\n")
465 #Get the current date this contains all the aspect of the date including date and time
466# now = datetime.datetime.now()
467 #In the report document write the date
468 # f.write("Date: "+str(now.day) +"/" + str(now.month) + "/" +str(now.year) +"\n")
469 #In the report document write the headings adding in tab to format this line
470 # f.write("First Name" +"\t" + "Surname" +"\n")
471 # f.write("\n")
472
473 #we are going through the list and the variable i will take on the data in each part of the list as we go through the for loop
474 # for i in pupils_array:
475
476 #Write the first name and use tabs to space it out properly
477 # f.write(i[0]+ "\t" + "\t")
478 #Write the surname and use new line to move onto the next line in the file
479 ## f.write(i[1] +"\n")
480 # f.write("\n")
481
482 # f.close()
483#####################################################################################################################################################################################################
484
485#ski_slopes
486 #reason:gives info
487 #returns:none
488 #parameters:none
489def ski_slopes():
490 raise_frame(ski_slopes_frame)
491
492 #reason:to allow the user to add a pupil to the file
493 #returns:none
494 #parameters:none
495def pupil_entry_frame():
496 raise_frame(pupilentry_frame)
497
498def AddP_clear_button():
499 firstname.set("")
500 surname.set("")
501 email.set("")
502 mobile.set("")
503
504def back_addp():
505 raise_frame(menu_frame)
506
507#reason:to find the desired pupil
508 #returns:none
509 #parameters:none
510def findpupil():
511 apupil_entername = pupil_entername.get()
512
513def findp_help():
514 messagebox.showinfo("User informtion", "Please enter the ID of the pupil", icon = "info")
515
516
517#reason:to display the skill groups
518 #returns:none
519 #parameters:none
520def pupilskillgroups():
521 raise_frame(pupil_skill_groups)
522
523#reason:to assist in deciding groups
524 #returns:none
525 #parameters:none
526def pupilquiz():
527 raise_frame(pupil_safety_quiz)
528
529#reason:to show the results the quiz
530 #returns:none
531 #parameters:none
532def Quiz_Results():
533 raise_frame(pupil_results)
534
535def help_QResults():
536 messagebox.showinfo('Help','Please press the "Show Results" button once you have chosen how you would like it to be displayed ',icon='info')
537
538
539def back_button_to_login():
540 back_response_times = messagebox.askquestion('Info','Are you sure you want to leave',icon='warning')
541 if (back_response_times == messagebox.YES):
542 raise_frame(login_frame)
543
544#A button to help the user on the add pupil frame
545def help_addp():
546 messagebox.showinfo('Help','Please enter in the required details',icon='info')
547
548#A button to help the user on the ski times report frame
549def help_repT():
550 messagebox.showinfo('Help','Please press the "Report By Ski Times" button',icon='info')
551
552#A button to help the user on the ski groups frame
553def help_Skigroups():
554 messagebox.showinfo('Help','Please select a Group from the dropdown menu, then press the "Find group" button',icon='info')
555
556#A button to help the user on the find student frame
557#def find_skill_group():
558#d collected_group =group_type.get()
559
560#-----------------------------------------------------------------------------------------
561#quiz
562def back_for_quiz():
563 print("Back")
564
565def Help_quiz():
566 print("Help")
567
568#Function: submit_Quiz
569#Reason: This will change look at all of the selections that have been made and will create a score
570#Returns: None
571#Parameters: None
572def submit_quiz1():
573#look for the ID and make sure it's valid
574
575
576 ski_walk_answer = ski_walk_question.get()
577 ski_equip_answer = ski_equip_question.get()
578 ski_time_answer = ski_time_question.get()
579 ski_body_answer = ski_body_question.get()
580 ski_binding_answer = ski_binding_question.get()
581 ski_condition_answer = ski_condition_question.get()
582 ski_occur_answer = ski_occur_question.get()
583 ski_helmet_answer = ski_helmet_question.get()
584 ski_leave_answer = ski_leave_question.get()
585 ski_injury_answer = ski_injury_question.get()
586
587 total_score=0
588
589 if ski_walk_answer == "sideways." :
590 total_score=total_score+1
591 print(total_score)
592 if ski_equip_answer == "Ski boots." :
593 total_score=total_score+1
594 print(total_score)
595 if ski_time_answer == "Afternoon.":
596 total_score=total_score+1
597 print(total_score)
598 if ski_body_answer == "Knees.":
599 total_score=total_score+1
600 print(total_score)
601 if ski_binding_answer == "Its tension.":
602 total_score=total_score+1
603 print(total_score)
604 if ski_condition_answer == "Dehydration.":
605 total_score=total_score+1
606 print(total_score)
607 if ski_occur_answer == "Ones first time skiing.":
608 total_score=total_score+1
609 print(total_score)
610 if ski_helmet_answer == "Always.":
611 total_score=total_score+1
612 print(total_score)
613 if ski_leave_answer == "No.":
614 total_score=total_score+1
615 print(total_score)
616 if ski_injury_answer == "Stop and tell the instructor.":
617 total_score=total_score+1
618 print(total_score)
619
620 str_total_score=str(total_score)
621 tkinter.messagebox.showinfo("Information", 'Your final score is '+str_total_score)
622# print("here")
623 # current_score.set("10")
624
625
626
627#Function: user_choice_button1
628#Reason: This will change take and the pupil option and change the score
629#Returns: None
630#Parameters: None
631#def pupil_choice_button1():
632# pupil_score = current_score.get()
633# pupil_score = int(pupil_score)+1
634# print(pupil_score)
635 # tkinter.messagebox.showinfo("Information", "Correct")
636# current_score.set(pupil_score)
637
638#Function: pupil_choice_button
639#Reason: This will change take and inform them that they are incorrect
640#Returns: None
641#Parameters: None
642def pupil_choice_button2():
643 tkinter.messagebox.showinfo("Information", "Incorrect, your score remains the same")
644
645#Function: pupil_choice_button
646#Reason: This will change take and inform them that they are incorrect
647#Returns: None
648#Parameters: None
649def pupil_choice_button3():
650 tkinter.messagebox.showinfo("Information", "Incorrect, your score remains the same")
651
652#Function: Raise Frame
653#Reason: This will change the Window/Frame that the user can see
654#Returns: None
655#Parameters: the name of the frame that you want to view
656def raise_frame(frame):
657 frame.tkraise()
658
659#Function: Start Quiz
660#Reason: This will take the user to the first part of the quiz
661#Returns: None
662#Parameters: none
663def start_quiz():
664 raise_frame(Question_frame1)
665 tkinter.messagebox.showinfo("Information", "Complete the first 5 multiple choice questions shown")
666
667def start_quiz2():
668 raise_frame(Question_frame2)
669 tkinter.messagebox.showinfo("Information", "Complete the next 5 multiple choice questions shown")
670
671
672#Function: Help Menu
673#Reason: This will send a message to the pupil about how to work the screen
674#Returns: None
675#Parameters: none
676def help_menu():
677 messagebox.showerror("Information", "Press the 'Click To Begin' button to start the quiz.")
678
679def help_quiz1():
680 messagebox.showerror("Information", "Please press the 'Select answer' buttons to answer the questions")
681
682#------------------------------------------------------------------------------------------
683#------------------------------------------------------------------------------------------
684#set up the GUI and cinfigure
685root = Tk()
686root.geometry("1000x720")
687#this will be how big the box will be
688root.title("gui title")
689root.config(bg='white')
690
691pupilsgroups = StringVar()
692
693#we will create the frames for the gui
694#frame for the login frame
695login_frame = Frame(root,width=1000,height=720,bg='white')
696
697#this will let the user imput their username and password
698menu_frame = Frame(root,width=1000,height=720,bg='white')
699
700#this frame will contain options for the staff or pupils to go to
701pupilentry_frame = Frame(root,width=1000,height=720,bg='white')
702
703#this frame will show the pupils groups
704pupil_groups_frame = Frame(root,width=1000,height=720,bg='white')
705
706#this is the frame for the tree view diagram
707SkitimesTV = Frame(root,width=1000,height=720,bg='white')
708
709#this is the frame for the pupil skill groups
710pupil_skill_groups = Frame(root,width=1000,height=720,bg='white')
711
712#frame fo the ski slopes
713ski_slopes_frame=Frame(root,width=1000,height=720,bg='white')
714
715#frame for the quiz
716pupil_safety_quiz = Frame(root,width=1000,height=720,bg='white')
717
718#frame for the pupil age report
719age_report_frame = Frame(root,width=1000,height=720,bg='white')
720
721#frame for the quiz results
722pupil_results = Frame(root,width=1000,height=720,bg='white')
723
724#frame for the quiz questions 1
725Question_frame1 = Frame(root,width=1000,height=720,bg='white')
726
727#frame for the seconed frame of questions
728Question_frame2 = Frame(root,width=1000,height=720,bg='white')
729
730
731#set up each frame to be gridded into rows and columns
732for frame in (login_frame, menu_frame, pupilentry_frame,ski_slopes_frame, pupil_groups_frame, SkitimesTV, pupil_skill_groups, pupil_safety_quiz, age_report_frame, pupil_results, Question_frame1, Question_frame2):
733 frame.grid(row = 0, column = 0, sticky = "news")
734
735
736#variable for the program
737#variables for the login frame
738username = StringVar()
739password = StringVar()
740
741#variable for the add pupil frame
742Name = StringVar()
743
744
745#------------------------------------------------------------------------------------------
746#------------------------------------------------------------------------------------------
747
748#variables for the login frame
749username = StringVar()
750password = StringVar()
751
752
753#components for each frame
754#components for the log in frame
755login_heading_labels = Label(login_frame, text = "Clarendon High School Login",bg='white',fg='#1874CD', font = ("Courier",45,"bold"))
756login_heading_labels.place(x=500,rely=0.1,anchor=CENTER)
757
758username_label = Label(login_frame, text = "Username: ",bg='white',fg='#1874CD',font = ("Courier",36,"bold"))
759username_label.place(x=375,rely=0.2,anchor=CENTER )
760
761username_entry = Entry(login_frame, textvariable = username,bg='#f8f8ff',font = ("Courier",28,"bold"),width=10)
762username_entry.place(x=625,rely=0.2,anchor=CENTER )
763
764password_label = Label( login_frame, text = "Password: ",bg='white',fg='#1874CD',font = ("Courier",36,"bold"))
765password_label.place(x=375,rely=0.29,anchor=CENTER )
766
767
768password_entry = Entry(login_frame, textvariable = password,bg='#f8f8ff', show = "*",font = ("Courier",28,"bold"),width=10)
769password_entry.place(x=625,rely=0.29,anchor=CENTER )
770
771
772login_clear_button = Button(login_frame, text = "Clear",bg='#f8f8ff',fg='#1874CD', command = login_clear_button,font = ("Courier",28,"bold"),width=5)
773login_clear_button.place(x=300,rely=0.4,anchor=CENTER )
774
775login_help_button = Button(login_frame, text = "Help",bg='#f8f8ff',fg='#1874CD', command = login_help,font = ("Courier",28,"bold"),width=5)
776login_help_button.place(x=450,rely=0.4,anchor=CENTER )
777
778login_submit_button = Button(login_frame, text = "Submit",bg='#f8f8ff',fg='#1874CD', command = login_submit,font = ("Courier",28,"bold"),width=9)
779login_submit_button.place(x=625,rely=0.4,anchor=CENTER)
780
781canvas = Canvas(login_frame, width = 500, height = 300, bg = "white")
782canvas.place(x=500,rely=0.7,anchor=CENTER)
783my_image = PhotoImage(file = "Skiingimage.png")
784canvas.create_image(0,0, anchor = NW, image = my_image)
785canvas.my_image = my_image
786#------------------------------------------------------------------------------------------
787#------------------------------------------------------------------------------------------
788
789#components for menu screen
790menu_title = Label(menu_frame, text = "Welcome to the Menu",bg='white',fg='#1874CD', font = ("Courier",48,"bold"))
791menu_title.place(x=500,rely=0.1,anchor=CENTER)
792
793summary1_button = Button(menu_frame, text = "Average times report", command = summary1_button,bg='#f8f8ff',fg='#1874CD',font = ("Courier",20,"bold"),width=30)
794summary1_button.place(x=500,rely=0.2,anchor=CENTER)
795
796summary2_button = Button(menu_frame, text = "Pupil Age Report", command = summary2_button,bg='#f8f8ff',fg='#1874CD',font = ("Courier",20,"bold"),width=30)
797summary2_button.place(x=500,rely=0.3,anchor=CENTER)
798
799add_pupil = Button(menu_frame, text = "Add Pupil", command = add_pupil,bg='#f8f8ff',fg='#1874CD',font = ("Courier",20,"bold"),width=30)
800add_pupil.place(x=500,rely=0.4,anchor=CENTER)
801
802ski_slopes = Button(menu_frame, text = "Ski Slopes Times", command = ski_slopes,bg='#f8f8ff',fg='#1874CD',font = ("Courier",20,"bold"),width=30)
803ski_slopes.place(x=500,rely=0.5,anchor=CENTER)
804
805pupilskillgroups = Button(menu_frame, text = "Skill groups", command = pupil_groups,bg='#f8f8ff',fg='#1874CD',font = ("Courier",20,"bold"),width=30)
806pupilskillgroups.place(x=500,rely=0.6,anchor=CENTER)
807
808pupilquiz = Button(menu_frame, text = "Quiz", command = pupilquiz,bg='#f8f8ff',fg='#1874CD',font = ("Courier",20,"bold"),width=30)
809pupilquiz.place(x=500,rely=0.7,anchor=CENTER)
810
811menu_help_button = Button(menu_frame, text = "Help", command = menu_help,bg='#f8f8ff',fg='#1874CD',font = ("Courier",20,"bold"),width=15)
812menu_help_button.place(x=620,rely=0.8,anchor=CENTER)
813
814menu_back_button = Button(menu_frame, text = "Back", command = back_button_to_login,bg='#f8f8ff',fg='#1874CD',font = ("Courier",20,"bold"),width=15)
815menu_back_button.place(x=380,rely=0.8,anchor=CENTER)
816
817#------------------------------------------------------------------------------------------
818#------------------------------------------------------------------------------------------
819#these are the variables that i will use for each component
820firstname = StringVar()
821surname = StringVar()
822email = StringVar()
823emailaddress = StringVar()
824
825gender_choice = IntVar()
826mobile = StringVar()
827
828
829lblHeading = Label(pupilentry_frame, text = "Add Pupil",bg='white',fg='#1874CD', font = ("Courier",72,"bold"))
830lblHeading .place(x=500,rely=0.1,anchor=CENTER)
831
832
833lblFirstName = Label(pupilentry_frame, text = "First Name:",bg='white',fg='#1874CD',font = ("Courier",28,"bold"))
834lblFirstName.place(x=375,rely=0.2,anchor=CENTER )
835
836entryfirstname = Entry(pupilentry_frame, textvariable = firstname,bg='#f8f8ff',font = ("Courier",20,"bold"),width=15)
837entryfirstname.place(x=625,rely=0.2,anchor=CENTER )
838
839lblSurName = Label(pupilentry_frame, text = "Surname:",bg='white',fg='#1874CD',font = ("Courier",28,"bold"))
840lblSurName.place(x=375,rely=0.29,anchor=CENTER )
841
842entryfirstname = Entry(pupilentry_frame, textvariable = surname,bg='#f8f8ff',font = ("Courier",20,"bold"),width=15)
843entryfirstname.place(x=625,rely=0.29,anchor=CENTER )
844
845#Radio buttons are here
846lblGender = Label(pupilentry_frame, text = "Gender:",bg='white',fg='#1874CD',font = ("Courier",28,"bold"))
847lblGender.place(x=375,rely=0.39,anchor=CENTER )
848
849gender_radiobutton1 = Radiobutton(pupilentry_frame, text = "Male", variable = gender_choice, value = 1,fg='#1874CD',bg='white',font = ("Courier",20,"bold"),width=5)
850gender_radiobutton1.place(x=550,rely=0.39,anchor=CENTER )
851
852gender_radiobutton2= Radiobutton(pupilentry_frame, text = "Female", variable = gender_choice, value = 2,fg='#1874CD',bg='white',font = ("Courier",20,"bold"),width=7)
853gender_radiobutton2.place(x=675,rely=0.39,anchor=CENTER )
854
855
856#this is for the label of email
857lblemail = Label(pupilentry_frame, text = "Email:",fg='#1874CD',bg='white',font = ("Courier",28,"bold"))
858lblemail.place(x=375,rely=0.49,anchor=CENTER )
859#this is for the entry box
860entryemail = Entry(pupilentry_frame, textvariable = email, bg='#f8f8ff',font = ("Courier",20,"bold"),width=8)
861entryemail.place(x=575,rely=0.49,anchor=CENTER )
862#here is the drop box list
863list1 = ["@gmail.com", "@hotmail.com", "@icloud.com", "@yahoo.com", "@c2kni.net"]
864droplist = OptionMenu(pupilentry_frame,emailaddress,*list1)
865droplist.config( bg='#f8f8ff',font = ("Courier",10,"bold"),width=10,height=1,fg='#1874CD')
866emailaddress.set("@gmail.com")
867droplist.place(x=710,rely=0.49,anchor=CENTER )
868
869
870lblMobile = Label(pupilentry_frame, text = "Mobile: +44",bg='white',fg='#1874CD',font = ("Courier",28,"bold"))
871lblMobile.place(x=375,rely=0.59,anchor=CENTER )
872
873entryMobile = Entry(pupilentry_frame, textvariable = mobile,bg='#f8f8ff',font = ("Courier",20,"bold"),width=15)
874entryMobile.place(x=625,rely=0.59,anchor=CENTER )
875
876lblAge = Label(pupilentry_frame, text = "Age:",bg='white',fg='#1874CD',font = ("Courier",28,"bold"))
877lblAge.place(x=375,rely=0.69,anchor=CENTER )
878
879age_spin=Spinbox( pupilentry_frame,from_ = 11 ,to =18,width =8,font=("Courier",28))
880age_spin.place(x=625,rely=0.69,anchor=CENTER )
881
882
883#here's the code for all the buttons
884
885submit_button = Button(pupilentry_frame, text = "Add", command = add_pupil_details,bg='#f8f8ff',fg='#1874CD',font = ("Courier",28,"bold"),width=5)
886submit_button.place(relx=0.74,rely=0.8,anchor=CENTER )
887
888back_button = Button(pupilentry_frame, text = "Back",command=back_addp,bg='#f8f8ff',fg='#1874CD',font = ("Courier",28,"bold"),width=5)
889back_button.place(x=325,rely=0.8,anchor=CENTER )
890
891help_button = Button(pupilentry_frame, text = "Help",command=help_addp,bg='#f8f8ff',fg='#1874CD',font = ("Courier",28,"bold"),width=5)
892help_button.place(x=465,rely=0.8,anchor=CENTER )
893
894addpupil_clear_button = Button(pupilentry_frame, text = "Clear",bg='#f8f8ff',fg='#1874CD', command = AddP_clear_button,font = ("Courier",28,"bold"),width=5)
895addpupil_clear_button.place(relx=0.6,rely=0.8,anchor=CENTER )
896
897
898#------------------------------------------------------------------------------------------
899#------------------------------------------------------------------------------------------
900id_pup=StringVar()
901slope_1_time=StringVar()
902slope_2_time=StringVar()
903slope_3_time=StringVar()
904slope_4_time=StringVar()
905slope_5_time=StringVar()
906
907lblHeadingfindtime = Label(ski_slopes_frame, text = "Find Time",bg='white',fg='#1874CD', font = ("Courier",72,"bold"))
908lblHeadingfindtime.place(x=500,rely=0.1,anchor=CENTER)
909
910id_pup_time_label = Label(ski_slopes_frame, text = "ID:",bg='white',fg='#1874CD',font = ("Courier",28,"bold"))
911id_pup_time_label.place(x=250,rely=0.19,anchor=CENTER)
912
913id_pup_time_entry = Entry(ski_slopes_frame,textvariable = id_pup,bg='#f8f8ff',font = ("Courier",28,"bold"),width=15)
914id_pup_time_entry.place(x=625,rely=0.19,anchor=CENTER)
915
916
917lblslope1 = Label(ski_slopes_frame, text = "Slope time 1:",fg='#1874CD',bg='white',font = ("Courier",28,"bold"))
918lblslope1.place(x=250,rely=0.29,anchor=CENTER)
919
920lblslope2 = Label(ski_slopes_frame, text = "Slope time 2:",fg='#1874CD',bg='white',font = ("Courier",28,"bold"))
921lblslope2.place(x=250,rely=0.39,anchor=CENTER)
922
923lblslope3 = Label(ski_slopes_frame, text = "Slope time 3:",fg='#1874CD',bg='white',font = ("Courier",28,"bold"))
924lblslope3.place(x=250,rely=0.49,anchor=CENTER)
925
926lblslope4 = Label(ski_slopes_frame, text = "Slope time 4:",fg='#1874CD',bg='white',font = ("Courier",28,"bold"))
927lblslope4.place(x=250,rely=0.59,anchor=CENTER)
928
929
930lblslope5 = Label(ski_slopes_frame, text = "Slope time 5:",fg='#1874CD',bg='white',font = ("Courier",28,"bold"))
931lblslope5.place(x=250,rely=0.69,anchor=CENTER)
932
933slope_time_1_entry = Entry(ski_slopes_frame,textvariable = slope_1_time,bg='#f8f8ff',font = ("Courier",28,"bold"),width=15)
934slope_time_1_entry.place(x=625,rely=0.29,anchor=CENTER)
935
936
937slope_time_2_entry = Entry(ski_slopes_frame,textvariable = slope_2_time,bg='#f8f8ff',font = ("Courier",28,"bold"),width=15)
938slope_time_2_entry.place(x=625,rely=0.39,anchor=CENTER)
939
940slope_time_3_entry = Entry(ski_slopes_frame,textvariable = slope_3_time,bg='#f8f8ff',font = ("Courier",28,"bold"),width=15)
941slope_time_3_entry.place(x=625,rely=0.49,anchor=CENTER)
942
943slope_time_4_entry = Entry(ski_slopes_frame,textvariable = slope_4_time,bg='#f8f8ff',font = ("Courier",28,"bold"),width=15)
944slope_time_4_entry.place(x=625,rely=0.59,anchor=CENTER)
945
946slope_time_5_entry = Entry(ski_slopes_frame,textvariable = slope_5_time,bg='#f8f8ff',font = ("Courier",28,"bold"),width=15)
947slope_time_5_entry.place(x=625,rely=0.69,anchor=CENTER)
948
949
950#Buttons
951time_find_button = Button(ski_slopes_frame, text = "Find",command = find_student,fg='#1874CD',bg='#f8f8ff',font = ("Courier",28,"bold"),width=12)
952time_find_button.place(x=650,rely=0.79,anchor=CENTER)
953
954time_back_buttton = Button(ski_slopes_frame, text = "Back",command = back,bg='#f8f8ff',fg='#1874CD',font = ("Courier",28,"bold"),width=7)
955time_back_buttton.place(x=200,rely=0.79,anchor=CENTER )
956
957time_help_button = Button(ski_slopes_frame, text = "Help",command = findp_help,bg='#f8f8ff',fg='#1874CD',font = ("Courier",28,"bold"),width=7)
958time_help_button.place(x=400,rely=0.79,anchor=CENTER )
959
960#------------------------------------------------------------------------------------------
961#------------------------------------------------------------------------------------------
962#the Gui components
963
964#row 0 heading #
965time_lblheading = Label(SkitimesTV, text = "Times Report",bg='white',fg='#1874CD', font = ("Courier",72,"bold"))
966time_lblheading.place(x=500,rely=0.1,anchor=CENTER)
967
968time_find_button = Button(SkitimesTV, text = "Report By Ski Times",command = display_ski_times,fg='#1874CD',bg='#f8f8ff',font = ("Courier",18,"bold"),width=50)
969time_find_button.place(relx=0.5,rely=0.2,anchor=CENTER)
970
971
972TimesTV = ttk.Treeview(SkitimesTV,height = 15, columns = ("Firstname", "Average Time"))
973TimesTV.place(relx=0.2,rely=0.3)
974
975time_scrollBar = Scrollbar(SkitimesTV, orient = 'vertical', command = TimesTV.yview)
976time_scrollBar.place(relx=0.8,rely=0.3,height=325)
977
978TimesTV.configure(xscrollcommand=time_scrollBar.set)
979
980TimesTV.heading("#0", text = "Pupil ID")
981TimesTV.heading("#1", text = "Firstname")
982TimesTV.heading("#2", text = "Average Time")
983
984#Buttons
985
986Rtime_back_buttton = Button(SkitimesTV, text = "Back",command = back,bg='#f8f8ff',fg='#1874CD',font = ("Courier",28,"bold"),width=7)
987Rtime_back_buttton.place(relx=0.4,rely=0.9,anchor=CENTER )
988
989Rtime_help_button = Button(SkitimesTV, text = "Help",command = help_repT,bg='#f8f8ff',fg='#1874CD',font = ("Courier",28,"bold"),width=7)
990Rtime_help_button.place(relx=0.6,rely=0.9,anchor=CENTER )
991#------------------------------------------------------------------------------------------
992#------------------------------------------------------------------------------------------
993
994#components for the skill groups
995
996group_type = StringVar()
997Group = StringVar()
998
999group_lblHeading = Label(pupil_groups_frame, text = "Skill Groups",bg='white',fg='#1874CD', font = ("Courier",72,"bold"))
1000group_lblHeading.place(x=500,rely=0.1,anchor=CENTER)
1001
1002find_group_button = Button(pupil_groups_frame, text = "Find group",command = find_skill_group,fg='#1874CD',bg='#f8f8ff',font = ("Courier",18,"bold"),width=50)
1003find_group_button.place(relx=0.5,rely=0.2,anchor=CENTER)
1004
1005
1006
1007
1008label_group= Label(pupil_groups_frame, text = "Choose a Ski group",fg='#1874CD',bg='#f8f8ff',font = ("Courier",18,"bold"))
1009label_group.place(relx=0.3,rely=0.3,anchor=CENTER)
1010
1011
1012pupilskillgroupslist = ["Beginner", "Intermediate", "Advanced","All"]
1013group_type.set("All")
1014droplist = OptionMenu(pupil_groups_frame,group_type,*pupilskillgroupslist)
1015droplist.config(width = 15)
1016
1017
1018droplist.place(relx=0.6,rely=0.3,anchor=CENTER)
1019
1020
1021hGroupTV = ttk.Treeview(pupil_groups_frame, height = 15, columns = ("First Name", "Last Name", "Group Level"))
1022hGroupTV.place(relx=0.1,rely=0.4)
1023
1024scrollBar = Scrollbar(pupil_groups_frame, orient = 'vertical', command = hGroupTV.yview)
1025scrollBar.place(relx=0.9,rely=0.4,height=325)
1026
1027hGroupTV.configure(yscrollcommand=scrollBar.set)
1028
1029hGroupTV.heading('#0', text = "Pupil ID")
1030hGroupTV.heading('#1', text = "First Name")
1031hGroupTV.heading('#2', text = "Last Name")
1032hGroupTV.heading('#3', text = "Group Level")
1033
1034#buttons
1035
1036Groups_back_buttton = Button(pupil_groups_frame, text = "Back",command = back,bg='#f8f8ff',fg='#1874CD',font = ("Courier",28,"bold"),width=7)
1037Groups_back_buttton.place(relx=0.4,rely=0.92,anchor=CENTER )
1038
1039Groups_help_button = Button(pupil_groups_frame, text = "Help",command = help_Skigroups,bg='#f8f8ff',fg='#1874CD',font = ("Courier",28,"bold"),width=7)
1040Groups_help_button.place(relx=0.6,rely=0.92,anchor=CENTER )
1041
1042#------------------------------------------------------------------------------------------
1043#------------------------------------------------------------------------------------------
1044#Here are the variables used to capture data entered in the various frames
1045#Quiz 1 Frame
1046quiz1_studentid = StringVar()
1047
1048#this is the StringVar that will contain the current score, i will refer to this variable as i am using multiple frames
1049current_score = StringVar()
1050
1051#these are the variables for the dropdown questions
1052ski_walk_question = StringVar()
1053ski_equip_question = StringVar()
1054ski_time_question = StringVar()
1055ski_body_question = StringVar()
1056ski_binding_question = StringVar()
1057ski_condition_question = StringVar()
1058ski_occur_question = StringVar()
1059ski_helmet_question = StringVar()
1060ski_leave_question = StringVar()
1061ski_injury_question = StringVar()
1062
1063
1064#components for the Quiz
1065#this code is for the initail menu frame of the quiz
1066menulabel1 = Label(pupil_safety_quiz, text = "Ski Safety Quiz", bg = "#f8f8ff",fg="#1874CD", font = ("Courier",40, "bold"))
1067menulabel1.place(relx=0.5,rely=0.1,anchor=CENTER)
1068
1069menu_start_button = Button(pupil_safety_quiz, text = "Click to Begin",command = start_quiz, bg = "#f8f8ff",fg="#1874CD", font = ("Courier",32,"bold"))
1070menu_start_button.place(relx=0.5,rely=0.3,anchor=CENTER)
1071
1072menu_help_button = Button(pupil_safety_quiz, text = "Help", command = help_menu, bg = '#f8f8ff',fg = '#1874CD', font = ("Courier",24,"bold"))
1073menu_help_button.place(relx= 0.7, rely=0.5, anchor=CENTER)
1074
1075Quiz_back_buttton1 = Button(pupil_safety_quiz, text = "Back",command = back,bg='#f8f8ff',fg='#1874CD',font = ("Courier",24,"bold"))
1076Quiz_back_buttton1.place(relx=0.3,rely=0.5,anchor=CENTER )
1077
1078canvas = Canvas(pupil_safety_quiz, width = 300, height = 254, bg = "white")
1079canvas.place(relx=0.46,rely=0.75,anchor=CENTER)
1080my_image = PhotoImage(file = "Ski-safe.png")
1081canvas.create_image(0,0, anchor = NW, image = my_image)
1082canvas.my_image = my_image
1083
1084results_buttton = Button(pupil_safety_quiz, text = "Results",command = Quiz_Results,bg='#f8f8ff',fg='#1874CD',font = ("Courier",24,"bold"))
1085results_buttton.place(relx=0.5,rely=0.5,anchor=CENTER )
1086#-----------------------------------------------------------------------------------------------------------
1087#In this section of the code I am going to add all the components required to create the Quiz 1 Frame (everything but the questions)
1088quiz1_intro_label = Label(Question_frame1, text = "General Knowledge Quiz",bg = "#f8f8ff",fg="#1874CD", font = ('Courier',30, 'bold'))
1089quiz1_intro_label.place(relx=0.5,rely=0.1,anchor=CENTER)
1090
1091quiz_studentid_label = Label(Question_frame1, text = "Please enter Student ID: ",bg = "#f8f8ff",fg="#1874CD", font = ('Courier', 20, 'bold'))
1092quiz_studentid_label.place(relx=0.3,rely=0.2,anchor=CENTER)
1093
1094quiz_student_entry = Entry(Question_frame1, textvariable = quiz1_studentid)
1095quiz_student_entry.place(relx=0.6,rely=0.2,anchor=CENTER)
1096
1097quiz1_score_label = Label(Question_frame1, text = "Score: ",bg = "#f8f8ff",fg="#1874CD",font = ('Courier',20,'bold'))
1098quiz1_score_label.place(relx=0.8,rely=0.2,anchor=CENTER)
1099
1100quiz1_score_display_label = Label(Question_frame1, textvariable = current_score,bg = "#f8f8ff",fg="#1874CD", font = ('Courier',20,'bold'))
1101quiz1_score_display_label.place(relx=0.9,rely=0.2,anchor=CENTER)
1102current_score.set("0")
1103
1104quiz_advice_label = Label(Question_frame1, text = "Answer the following questions:",bg = "#f8f8ff",fg="#1874CD", font = ('Courier',20,'bold'))
1105quiz_advice_label.place(relx=0.5,rely=0.3,anchor=CENTER)
1106
1107Quiz1_help_button = Button(Question_frame1, text = "Help", command = help_quiz1, bg = '#f8f8ff',fg = '#1874CD', font = ("Courier",24,"bold"))
1108Quiz1_help_button.place(relx= 0.4, rely=0.9, anchor=CENTER)
1109
1110Next_button = Button(Question_frame1, text = "Next", command = start_quiz2,bg='#f8f8ff',fg='#1874CD',font = ("Courier",24,"bold"))
1111Next_button.place(relx=0.7,rely=0.9,anchor=CENTER)
1112#-----------------------------------------------------------------------------------------------------------------------------------------
1113#components for the first frame of questions (1-5)
1114#Question 1
1115quiz_q1_question = Label(Question_frame1, text = "1) What way should you face when walking up an mountain, while wearing ski boots?",bg = "#f8f8ff",fg="#1874CD",font = ('Courier',12,'bold'))
1116quiz_q1_question.place(relx=0.42,rely=0.4,anchor=CENTER)
1117list1 = ['Forwards', 'Backwards', 'sideways.']
1118
1119droplist = OptionMenu(Question_frame1,ski_walk_question,*list1)
1120droplist.config(width = 15)
1121ski_walk_question.set('Select answer')
1122droplist.place(relx=0.9,rely=0.4,anchor=CENTER)
1123#-----------------------------------------------------------------------------------------------------------------------------------------------------
1124#Question 2
1125quiz_q2_question = Label(Question_frame1, text = "2) What the most important piece of equipment for skiing?",bg = "#f8f8ff",fg="#1874CD",font = ('Courier',12,'bold'))
1126quiz_q2_question.place(relx=0.30,rely=0.5,anchor=CENTER)
1127list2 = ['Gloves', 'Socks', 'Ski boots.']
1128
1129droplist = OptionMenu(Question_frame1,ski_equip_question,*list2)
1130droplist.config(width = 15)
1131ski_equip_question.set('Select answer')
1132droplist.place(relx=0.9,rely=0.5,anchor=CENTER)
1133#----------------------------------------------------------------------------------------------------------------------------------------------------------
1134#Question 3
1135quiz_q3_question = Label(Question_frame1, text = "3) What time of day is it most dangerous to ski at?",bg = "#f8f8ff",fg="#1874CD",font = ('Courier',12,'bold'))
1136quiz_q3_question.place(relx=0.27,rely=0.6,anchor=CENTER)
1137list3 = ['Morning', 'Afternoon.', 'Evening']
1138
1139droplist = OptionMenu(Question_frame1,ski_time_question,*list3)
1140droplist.config(width = 15)
1141ski_time_question.set('Select answer')
1142droplist.place(relx=0.9,rely=0.6,anchor=CENTER)
1143#-------------------------------------------------------------------------------------------------------------------------------------------------------------
1144#Question 4
1145quiz_q4_question = Label(Question_frame1, text = "4) What is the most vanerable part of your body while skiing?",bg = "#f8f8ff",fg="#1874CD",font = ('Courier',12,'bold'))
1146quiz_q4_question.place(relx=0.32,rely=0.7,anchor=CENTER)
1147list4 = ['Hands', 'Knees.', 'Ankles']
1148
1149droplist = OptionMenu(Question_frame1,ski_body_question,*list4)
1150droplist.config(width = 15)
1151ski_body_question.set('Select answer')
1152droplist.place(relx=0.9,rely=0.7,anchor=CENTER)
1153#------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1154#Question 5
1155quiz_q5_question = Label(Question_frame1, text = "5) What common problems do skiers have with their bindings?",bg = "#f8f8ff",fg="#1874CD",font = ('Courier',12,'bold'))
1156quiz_q5_question.place(relx=0.31,rely=0.8,anchor=CENTER)
1157list5 = ['Its tension.', 'Breaking unexpectedly', 'They jam']
1158
1159droplist = OptionMenu(Question_frame1,ski_binding_question,*list5)
1160droplist.config(width = 15)
1161ski_binding_question.set('Select answer')
1162droplist.place(relx=0.9,rely=0.8,anchor=CENTER)
1163
1164#-------------------------------------------------------------------------------------------------------------------------------------------------------------------
1165#set up for the second frame of questions(6-10)
1166quiz2_intro_label = Label(Question_frame2, text = "General Knowledge Quiz Part 2",bg = "#f8f8ff",fg="#1874CD", font = ('Courier',30, 'bold'))
1167quiz2_intro_label.place(relx=0.5,rely=0.1,anchor=CENTER)
1168
1169quiz2_score_label = Label(Question_frame2, text = "Score: ",bg = "#f8f8ff",fg="#1874CD",font = ('Courier',20,'bold'))
1170quiz2_score_label.place(relx=0.5,rely=0.2,anchor=CENTER)
1171
1172quiz2_score_display_label = Label(Question_frame2, textvariable = current_score,bg = "#f8f8ff",fg="#1874CD", font = ('Courier',20,'bold'))
1173quiz2_score_display_label.place(relx=0.55,rely=0.2,anchor=CENTER)
1174current_score.set("0")
1175
1176quiz2_advice_label = Label(Question_frame2, text = "Answer the following questions:",bg = "#f8f8ff",fg="#1874CD", font = ('Courier',20,'bold'))
1177quiz2_advice_label.place(relx=0.5,rely=0.3,anchor=CENTER)
1178
1179Quiz2_help_button = Button(Question_frame2, text = "Help", command = help_quiz1, bg = '#f8f8ff',fg = '#1874CD', font = ("Courier",24,"bold"))
1180Quiz2_help_button.place(relx= 0.3, rely=0.9, anchor=CENTER)
1181
1182submit_button = Button(Question_frame2, text = "Submit", command = submit_quiz1,bg='#f8f8ff',fg='#1874CD',font = ("Courier",24,"bold")) #need to make functional
1183submit_button.place(relx=0.7,rely=0.9,anchor=CENTER)
1184#---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1185#Question 6
1186quiz_q6_question = Label(Question_frame2, text = "6) What non-injury condition are skiers most vunerable to?",bg = "#f8f8ff",fg="#1874CD",font = ('Courier',12,'bold'))
1187quiz_q6_question.place(relx=0.42,rely=0.4,anchor=CENTER)
1188list6 = ['Vertigo', 'Dehydration.', 'Frostbite']
1189
1190droplist = OptionMenu(Question_frame2,ski_condition_question,*list6)
1191droplist.config(width = 15)
1192ski_condition_question.set('Select answer')
1193droplist.place(relx=0.9,rely=0.4,anchor=CENTER)
1194#-----------------------------------------------------------------------------------------------------------------------------------------------------------------
1195#Question 7
1196quiz_q7_question = Label(Question_frame2, text = "7) When do many skiing injuries occur?",bg = "#f8f8ff",fg="#1874CD",font = ('Courier',12,'bold'))
1197quiz_q7_question.place(relx=0.32,rely=0.5,anchor=CENTER)
1198list7 = ['After heavy snowfall', 'Ones first time skiing.', 'During jumps']
1199
1200droplist = OptionMenu(Question_frame2,ski_occur_question,*list7)
1201droplist.config(width = 15)
1202ski_occur_question.set('Select answer')
1203droplist.place(relx=0.9,rely=0.5,anchor=CENTER)
1204#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1205#Question 8
1206quiz_q8_question = Label(Question_frame2, text = "8) When should you be wearing your ski helmet?",bg = "#f8f8ff",fg="#1874CD",font = ('Courier',12,'bold'))
1207quiz_q8_question.place(relx=0.36,rely=0.6,anchor=CENTER)
1208list8 = ['Always.', 'When learing', 'Going down advanced slopes']
1209
1210droplist = OptionMenu(Question_frame2,ski_helmet_question,*list8)
1211droplist.config(width = 15)
1212ski_helmet_question.set('Select answer')
1213droplist.place(relx=0.9,rely=0.6,anchor=CENTER)
1214#---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1215#Question 9
1216quiz_q9_question = Label(Question_frame2, text = "9) Should you leave you instructor while skiing?",bg = "#f8f8ff",fg="#1874CD",font = ('Courier',12,'bold'))
1217quiz_q9_question.place(relx=0.37,rely=0.7,anchor=CENTER)
1218list9 = ['Yes', 'No.']
1219
1220droplist = OptionMenu(Question_frame2,ski_leave_question,*list9)
1221droplist.config(width = 15)
1222ski_leave_question.set('Select answer')
1223droplist.place(relx=0.9,rely=0.7,anchor=CENTER)
1224#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1225#Question 10
1226quiz_q10_question = Label(Question_frame2, text = "10) What should you do if you get injured while skiing?",bg = "#f8f8ff",fg="#1874CD",font = ('Courier',12,'bold'))
1227quiz_q10_question.place(relx=0.4,rely=0.8,anchor=CENTER)
1228list10 = ['Stop and tell the instructor.', 'Keep going', 'Dont tell anyone']
1229
1230droplist = OptionMenu(Question_frame2,ski_injury_question,*list10)
1231droplist.config(width = 15)
1232ski_injury_question.set('Select answer')
1233droplist.place(relx=0.9,rely=0.8,anchor=CENTER)
1234
1235
1236
1237
1238#---------------------------------------------------------------------------------------------------------------------------
1239#components for the quiz results
1240
1241group_type = StringVar()
1242
1243Quiz_Results_lblheading = Label(pupil_results, text = "Quiz Results Report",bg='white',fg='#1874CD', font = ("Courier",55,"bold"))
1244Quiz_Results_lblheading.place(relx=0.5,rely=0.1,anchor=CENTER)
1245
1246find_group_button = Button(pupil_results, text = "Show Results",command = find_skill_group,fg='#1874CD',bg='#f8f8ff',font = ("Courier",18,"bold"),width=50)
1247find_group_button.place(relx=0.5,rely=0.2,anchor=CENTER)
1248
1249label_group= Label(pupil_results, text = "How would like the data to be shown? ",fg='#1874CD',bg='#f8f8ff',font = ("Courier",18,"bold")) #results code not working yet just components in
1250label_group.place(relx=0.3,rely=0.3,anchor=CENTER)
1251
1252pupilskillgroupslist = ["Highest to Lowest", "Lowest to Highest"]# #you will change GroupTV to ResultsTV
1253group_type.set("Highest to Lowest")
1254droplist = OptionMenu(pupil_results,group_type,*pupilskillgroupslist)#
1255droplist.config(width = 15)
1256
1257droplist.place(relx=0.7,rely=0.3,anchor=CENTER)
1258
1259GroupTV = ttk.Treeview(pupil_results, height = 15, columns = ("First Name", "Last Name", "Quiz Results"))
1260GroupTV.place(relx=0.1,rely=0.4)
1261
1262scrollBar = Scrollbar(pupil_results, orient = 'vertical', command = GroupTV.yview)
1263scrollBar.place(relx=0.9,rely=0.4,height=325)
1264
1265GroupTV.configure(yscrollcommand=scrollBar.set)
1266
1267GroupTV.heading('#0', text = "Pupil ID")
1268GroupTV.heading('#1', text = "First Name")
1269GroupTV.heading('#2', text = "Last Name")
1270GroupTV.heading('#3', text = "Quiz Results")
1271
1272#buttons----------------------------------------------------------------------------------------------------------
1273
1274QuizR_back_buttton1 = Button(pupil_results, text = "Back",command = back,bg='#f8f8ff',fg='#1874CD',font = ("Courier",24,"bold"))
1275QuizR_back_buttton1.place(relx=0.2,rely=0.9,anchor=CENTER )
1276
1277QuizR_help_button = Button(pupil_results, text = "Help",command = help_QResults,bg='#f8f8ff',fg='#1874CD',font = ("Courier",24,"bold"))
1278QuizR_help_button.place(relx=0.8,rely=0.9,anchor=CENTER )
1279
1280#-------------------------------------------------------------------------------------------------------------------------------
1281#components for AGES of the pupils report
1282
1283Age_lblheading = Label(age_report_frame, text = "Pupil Ages Report",bg='white',fg='#1874CD', font = ("Courier",68,"bold"))
1284Age_lblheading.place(x=500,rely=0.1,anchor=CENTER)
1285
1286Age_find_button = Button(age_report_frame, text = "Ages of the Pupils",command = display_ski_times,fg='#1874CD',bg='#f8f8ff',font = ("Courier",18,"bold"),width=50)
1287Age_find_button.place(relx=0.5,rely=0.25,anchor=CENTER)
1288
1289
1290AgesTV = ttk.Treeview(age_report_frame,height = 15, columns = ("Firstname", "Average Time"))
1291AgesTV.place(relx=0.2,rely=0.3)
1292
1293Age_scrollBar = Scrollbar(age_report_frame, orient = 'vertical', command = TimesTV.yview)
1294Age_scrollBar.place(relx=0.8,rely=0.3,height=325)
1295
1296AgesTV.configure(xscrollcommand=time_scrollBar.set)
1297
1298AgesTV.heading("#0", text = "Pupil ID")
1299AgesTV.heading("#1", text = "Firstname")
1300AgesTV.heading("#2", text = "Age")
1301
1302#Buttons
1303
1304Ages_back_buttton = Button(age_report_frame, text = "Back",command = back,bg='#f8f8ff',fg='#1874CD',font = ("Courier",28,"bold"),width=7)
1305Ages_back_buttton.place(relx=0.4,rely=0.9,anchor=CENTER )
1306
1307Ages_help_button = Button(age_report_frame, text = "Help",command = help_AgesRep,bg='#f8f8ff',fg='#1874CD',font = ("Courier",28,"bold"),width=7)
1308Ages_help_button.place(relx=0.6,rely=0.9,anchor=CENTER )
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340#here we call the function raise_frame to bring the log in frame into view
1341raise_frame(login_frame)
1342#here is where the magic happens
1343root.mainloop()