· 6 years ago · Aug 13, 2019, 03:30 PM
1
2#Import appropriate libraries from python
3from tkinter import*
4#tkinter allows you to create a gui
5import csv
6#
7import sys
8#allows us to kill the program
9import random
10#allows the creation of a random number for student id
11import tkinter.simpledialog
12import math
13
14import string
15#all functions for the program will be written here
16
17#Function Name:help_entry
18#reason: this will prompt the user with instructions on what to do
19#return: none
20#parameter:none
21def help_entry():
22 messagebox.showinfo('User help','Click the enter button to move on .',icon='info')
23
24
25#Function Name: raise_frame
26#reason: this will raise a partictular frame to allow it to be used by a user
27#returns: none
28#parameter: name of the frame the user wants to see
29def raise_frame(frame_name):
30 frame_name.tkraise()
31
32#Function Name: clear_Login
33#reason: this will clear the username and passwords
34#return: none
35#parameter: none
36
37def clear_login():
38 back_response = messagebox.askquestion('Back','Are you sure you want to clear your details',icon='warning')
39 if back_response == messagebox.YES:
40 username.set('')
41 password.set('')
42
43#Function Name:help_login
44#reason: this will prompt the user with instructions on what to do
45#return: none
46#parameter:none
47
48def help_login():
49 messagebox.showinfo('User help','Fill in the username and password into the entry box please.',icon='info')
50
51
52
53
54
55#Function Name: login_submit
56#reason: submits user name and passwords
57#return: none
58#parameter: none
59
60def login_submit():
61 #get the data that has been entered
62 login_username = username.get()
63 login_password = password.get()
64 #presence and type check
65
66 if(login_username == '' or login_password == '' or login_username.isnumeric( )== True or login_password.isnumeric() == True):
67 messagebox.showinfo('User information','invalid data entered',icon='warning')
68 #access username and password file
69 else:
70 with open('usernameandpassword.txt','rU')as csvfile:
71 found =0
72 #creating variable found indictating if a variable id it is found or not
73 reader = csv.reader(csvfile)
74 for row in reader:
75 if (login_username == row[0] and login_password == row[1]):
76 raise_frame(menu_frame)
77 #found changes to 1 as the user name and password has been found
78 found = 1
79 csvfile.close()
80 if ( found == 0):
81 messagebox.showinfo('User information',login_username +' does not exist',icon = 'error')
82
83
84#Function Name: add_pupil_menu
85#reason: allows a user to add the details of a user
86#return: none
87#parameter: none
88
89def add_pupil_menu():
90 raise_frame(pupilentry_frame)
91
92
93#Function Name: studenttest_menu
94#reason: allows a user to get tested on ski saftey
95#return: none
96#parameter: none
97def studenttest_menu():
98 raise_frame(pupiltested_frame)
99
100#Function Name:ski_time_menu
101#reason:allows a user to enter the ski times of a student
102#return: none
103#parameter: none
104def ski_time_menu():
105 raise_frame(skitimes_frame)
106
107
108
109#Function Name:average_time_menu
110#reason:displays the results of a pupils average ski times
111def average_time_menu():
112 raise_frame(averagetime_frame)
113
114#Function Name: login_frame back_button_frame
115#reason gives the user the ability to go back to the login frame
116def back_button_menu():
117 raise_frame(login_frame)
118
119 username.set('')
120 password.set('')
121
122
123
124#Function Name: pupil_group_menu
125#reason:Displays a list of a students group level
126def pupil_group_menu():
127 raise_frame(pupilgroup_frame)
128
129
130#Function Name:help_login
131#reason: this will prompt the user with instructions on what to do
132#return: none
133#parameter:none
134
135def help_menu():
136 messagebox.showinfo('User help','Click one of the buttons to do task wanted .',icon='info')
137
138#Function Name: back_button_details
139#reason gives the user the ability to go back to the menu frame
140def back_button_details():
141 back_response = messagebox.askquestion('Back','Are you sure you want to leave as details will be cleared',icon='warning')
142 if back_response == messagebox.YES:
143 raise_frame(menu_frame)
144 clear_detail()
145
146#Function Name: clear_menu
147#reason: allows a user to clear all of the data entered
148def clear_detail():
149 firstname.set('')
150 surname.set('')
151 pupil_email.set('')
152 postcode.set('')
153 address1.set('')
154 address2.set('')
155 yeargroup.set('Year10')
156 parents_contactnumber.set('')
157 medical_condition.set('None')
158 emailtype.set('@gmail.com')
159 gender.set(0)
160
161#Function Name: submit_details
162#reason: allows a user to submit the pupils details to a csv file
163#returns: none
164#parameter: none
165def submit_details():
166 pupil_id = random.randint(100,10000)
167 pupil_firstname=firstname.get()
168 pupil_surname=surname.get()
169 student_email =pupil_email.get()
170 pupil_emailtype = emailtype.get()
171 #join the 2 parts of email together to form single addresse (concatentation)
172 pupil_final_email = student_email+ pupil_emailtype
173 pupil_postcode = postcode.get()
174 pupil_address1 = address1.get()
175 pupil_address2 = address2.get()
176 pupil_yeargroup = yeargroup.get()
177 pupil_parents_contactnumber =parents_contactnumber .get()
178 pupil_medical_condition = medical_condition.get()
179 pupil_gender=gender.get()
180 #get the value from the spin box
181 #we reference the component directly as there is no variable assigned
182 pupil_age = age_spin.get()
183 int_pupil_age = int(pupil_age)
184
185
186
187 if pupil_gender == 1:
188 pupilfinalgender = 'Male'
189 else:
190 pupilfinalgender = 'Female'
191 #checking that all data has been entered or pupil_firstname.isnumeric() == True
192 if pupil_firstname == '' :
193 messagebox.showinfo('Enter ','Make sure the pupil firstname has been entered in the entry box',icon = 'error')
194 elif pupil_surname == '':
195 messagebox.showinfo('Enter ','Make sure the pupil surname has been entered in the entry box',icon = 'error')
196 elif student_email == '':
197 messagebox.showinfo('Enter ',"Make sure the pupil's email has been entered in the entry box",icon = 'error')
198 elif pupil_postcode =='' :
199 messagebox.showinfo('Enter ',"Make sure the pupil's postcode has been entered in the entry box",icon = 'error')
200 elif pupil_parents_contactnumber == '':
201 messagebox.showinfo('Enter ',"Make sure the pupil's parents contactnumber has been entered in the entry box",icon = 'error')
202 elif pupil_gender == 0 :
203 messagebox.showinfo('Enter ',"Make sure the pupil's gender has been selected ",icon = 'error')
204 #checking that a first name and sure
205 if pupil_firstname.isnumeric() == True :
206 messagebox.showinfo('Enter ','Make sure the pupil firstname has no numbers please',icon = 'error')
207 elif pupil_surname.isnumeric() == True:
208 messagebox.showinfo('Enter ','Make sure the pupil surname has no numbers please',icon = 'error')
209 #making sure that the age conforrms with the yeargroup
210 #Year 8 ages 11 to 12
211 elif pupil_yeargroup == 'Year8' and int_pupil_age >12:
212 messagebox.showinfo('Age Checker ','Make sure the age matches the year group',icon = 'error')
213
214 #Year9 ages 12 to 13
215 elif pupil_yeargroup == 'Year9' and int_pupil_age >13 :
216 messagebox.showinfo('Age Checker ','Make sure the age matches the year group',icon = 'error')
217 elif pupil_yeargroup == 'Year9' and int_pupil_age <12 :
218 messagebox.showinfo('Age Checker ','Make sure the age matches the year group',icon = 'error')
219
220 #Year10 ages 13 to 14
221 elif pupil_yeargroup == 'Year10' and int_pupil_age >14 :
222 messagebox.showinfo('Age Checker ','Make sure the age matches the year group',icon = 'error')
223 elif pupil_yeargroup == 'Year10' and int_pupil_age <13 :
224 messagebox.showinfo('Age Checker ','Make sure the age matches the year group',icon = 'error')
225
226 #Year11 ages 14 to 15
227 elif pupil_yeargroup == 'Year11' and int_pupil_age >14:
228 messagebox.showinfo('Age Checker ','Make sure the age matches the year group',icon = 'error')
229 elif pupil_yeargroup == 'Year11' and int_pupil_age <15:
230 messagebox.showinfo('Age Checker ','Make sure the age matches the year group',icon = 'error')
231
232 #Year 12 ages 15 to 16
233 elif pupil_yeargroup == 'Year12' and int_pupil_age >16 :
234 messagebox.showinfo('Age Checker ','Make sure the age matches the year group',icon = 'error')
235 elif pupil_yeargroup == 'Year12' and int_pupil_age <15:
236 messagebox.showinfo('Age Checker ','Make sure the age matches the year group',icon = 'error')
237
238 #Year13 ages 16 to 17
239 elif pupil_yeargroup == 'Year13' and int_pupil_age >17 :
240 messagebox.showinfo('Age Checker ','Make sure the age matches the year group',icon = 'error')
241 elif pupil_yeargroup == 'Year13' and int_pupil_age <16:
242 messagebox.showinfo('Age Checker ','Make sure the age matches the year group',icon = 'error')
243
244 #Year14 ages 17 to 18
245 elif pupil_yeargroup == 'Year14' and int_pupil_age >18 :
246 messagebox.showinfo('Age Checker ','Make sure the age matches the year group',icon = 'error')
247 elif pupil_yeargroup == 'Year14' and int_pupil_age <17:
248 messagebox.showinfo('Age Checker ','Make sure the age matches the year group',icon = 'error')
249
250 #The telephone number can't be in letters
251 elif pupil_parents_contactnumber.isnumeric()==False :
252 messagebox.showinfo('Numbers only ','Make sure you only enter numbers for Parents phone number ' ,icon = 'error')
253
254
255
256
257
258
259 else:
260 #create a yes/no message box #title #text #icon
261 add_response = messagebox.askquestion('Adding a record','Are you sure',icon='warning')
262 if add_response == messagebox.YES:
263 with open ('Pupil detail.txt','a')as csvfile:
264 writer = csv.writer(csvfile)
265 writer.writerow([str (pupil_id),
266 pupil_firstname,
267 pupil_surname,
268 pupil_final_email,
269 pupil_postcode,
270 pupil_address1,
271 pupil_address2,
272 pupil_yeargroup,
273 pupil_parents_contactnumber,
274 pupil_medical_condition,
275 pupilfinalgender ])
276 #open csv file and commit all changes
277 messagebox.showinfo('Information','All data has been added')
278 messagebox.showinfo('Information','Your id is'+ str(pupil_id))
279 csvfile.close()
280
281
282
283
284
285
286
287
288
289
290#Function nameclear_warning
291#reason to give the user a warning before clearing pupils data
292#returns: none
293#parameter: none
294def clear_warning():
295 clear_response = messagebox.askquestion('Adding a record','Are you sure you want to clear',icon='warning')
296 if clear_response == messagebox.YES:
297 clear_detail()
298
299#Function: help_menu
300#reason: to tell the user on what to do
301#returns: none
302#parameter: none
303def help_detail():
304 messagebox.showinfo('Information','Fill in the pupils details then press the submit button')
305
306#Function: move_to_login
307#reason:to make it so the user can access the login frame
308#return: none
309#parameter: none
310def move_to_login():
311 raise_frame(login_frame)
312
313
314
315
316
317#Function Name: back_button_details
318#reason gives the user the ability to go back to the menu frame
319
320def back_button_times():
321 back_response_times = messagebox.askquestion('Back','Are you sure you want to leave as details will be cleared',icon='warning')
322 if (back_response_times == messagebox.YES):
323 raise_frame(menu_frame)
324
325
326#Function Name: check_button_times
327#reason gives the user the ability to check if their pupil id is valid
328#def check_button_times():
329 #times_id = student_id_times.get()
330 #if(times_id =='' ):
331 # print('yup')
332def check_button_times():
333 with open('Pupil detail.txt', 'r') as csvfile:
334 #found_times=0
335 reader = csv.reader(csvfile)
336 for row in reader:
337 print(row[0]!=None)
338 #if (times_id == row[0]):
339 #messagebox.showinfo('User Check','Your Pupil Id is valid',icon='warning')
340 #found_times = 1
341
342 csvfile.close()
343
344
345
346
347
348
349#set up the gui and configure
350root = Tk()
351root.geometry('1280x720')
352root.title('Gcse task 2019')
353#adding colour to the background of the window
354
355root.configure(bg='#dfe3ee')
356
357#In this section we will create the frames for the gui
358
359#here is the entrance frame
360entry_frame=Frame(root,bg='#dfe3ee')
361
362
363#here is where a staff member can login
364login_frame=Frame(root,bg='#dfe3ee' )
365
366#a menu where a user that has logged in can select the various options
367menu_frame=Frame(root,bg='#dfe3ee',width=1280, height=720 )
368
369#here is where a staff memeber can enter all of the students data
370pupilentry_frame=Frame(root,bg='#dfe3ee',width=1280, height=720)
371
372#here is where a pupil can get tested on knowledge of ski safety
373pupiltested_frame= Frame(root,bg='#dfe3ee')
374
375
376#here is where a user can enter the 5 ski slope times for each pupil
377skitimes_frame=Frame(root,bg='#dfe3ee',width=1280, height=720)
378
379
380#displays an average time for each pupil
381averagetime_frame=Frame(root,bg='#dfe3ee')
382
383#displays each pupil in each group
384pupilgroup_frame=Frame(root,bg= '#dfe3ee')
385
386
387
388#set up each frame to be grided into rows and columns
389for frame in(entry_frame,login_frame,menu_frame,pupilentry_frame,pupiltested_frame,skitimes_frame,averagetime_frame,pupilgroup_frame):
390 frame.grid(row = 0 , column=0,sticky='nesw')
391
392
393
394#variables for the program
395#variables for the login frame
396
397username = StringVar()
398password = StringVar()
399
400
401
402
403
404#**********************************************************************************************************************************
405#-components for each frame:
406#**********************************************************************************************************************************
407#
408#components for entrance frame
409#**********************************************************************************************************************************
410
411#the title for the entry frame
412entry_title_label = Label(entry_frame, text = "Welcome to Mr Walsh's Skiing Program", font = ('bold 20'), bg = 'white',padx=400,pady=20)
413entry_title_label.grid(row = 1,sticky = 'nesw')
414
415#blank label for a space between the tile and image
416blanklabel = Label(entry_frame,text = '',bg='#dfe3ee',pady=10)
417blanklabel.grid(row=2 ,column=1)
418
419#making a canvas and is where the image is going to be placed
420canvas = Canvas(entry_frame,width=300, height=168, bg = "white")
421canvas.grid(row=3,column=0)
422
423#The image
424my_image = PhotoImage(file="skiing.png")
425
426#Putting the image on the canvas
427canvas.create_image(0,0, anchor = NW, image=my_image)
428canvas.my_image = my_image
429
430#blank label which provides a space between the button and the image
431blanklabel = Label(entry_frame,text = '',bg='#dfe3ee',pady=10)
432blanklabel.grid(row=4 ,column=1)
433
434#button made so that the user can enter the login frame
435#entry_button = Button(entry_frame, text = "Enter", command = move_to_login, font = ('bold 20'), bg = "white")
436#entry_button.grid(row = 5,column=0)
437entry_button = Button(entry_frame, text = "Enter", command = move_to_login, font = ('bold 20'), bg = "white")
438entry_button.grid(row = 5,column=0)
439
440
441
442#help button
443entry_helpbutton=Button(entry_frame,text='Help ',command= help_entry,bg='white',font=('bold',20))
444entry_helpbutton.grid(row = 5,sticky = 'w')
445
446
447
448#**********************************************************************************************************************************
449#
450#components for login frame
451#**********************************************************************************************************************************
452#heading for the login screen
453login_heading_label =Label(login_frame,text='Login',bg='#dfe3ee',font=('bold',72))
454login_heading_label.place(x=500,y=1)
455#login_heading_label.grid(row=1,column=3,columnspan=1,sticky='e')
456
457
458
459#username label
460username_label=Label(login_frame,text='Username',bg='#dfe3ee' ,font=('bold',30))
461username_label.place(x=400,y=150)
462#username_label.grid(row=2,column=1,sticky='e')
463
464
465#username entry
466username_entry=Entry(login_frame,textvariable = username ,bg='white',font=('bold',30),width=10)
467username_entry.place(x=600,y=150)
468
469#password label
470password_label=Label(login_frame,text='Password ',bg='#dfe3ee' ,font=('bold',30))
471password_label.place(x=400,y=200)
472
473#password entry
474password_entry=Entry(login_frame,textvariable=password,show='*',bg='white',font=('bold',30),width=10)
475password_entry.place(x=600,y=200)
476
477#Buttons
478
479#submit button
480login_submit=Button(login_frame,text='Submit',command = login_submit,bg='#ff1919',font=('bold',20 ),width=25)
481login_submit.place(x=410,y=255)
482
483
484#clearbutton
485login_clearbutton=Button(login_frame,text='Clear',command = clear_login,bg='#dfe3ee',font=('bold',20))
486login_clearbutton.place(x=820,y=255)
487
488#help button
489login_helpbutton=Button(login_frame,text='Help ',command= help_login,bg='#dfe3ee',font=('bold',20))
490login_helpbutton.place(x=340,y=255)
491
492#************************************************************************************************************************************
493#-Components for the menu frame
494#************************************************************************************************************************************
495
496#login_heading_label =Label(login_frame,text='Login',bg='#dfe3ee',font=('bold',72))
497#login_heading_label.place(x=500,y=1)
498#Components for the menu frame
499
500menu_heading = Label(menu_frame,text = 'Menu',bg = '#dfe3ee' , font = ('bold',72))
501menu_heading.place(x=500,y=1)
502
503#back button
504menu_back_button=Button(menu_frame,text='Back',command = back_button_menu,bg='#c0c5ce',font = ('bold',48) )
505menu_back_button.place(x=1,y=1)
506
507#button to add pupil details
508pupil_entry_button = Button(menu_frame,text='Add pupil detail',command = add_pupil_menu,pady=10,font = ('bold',10),padx=250,width=10)
509pupil_entry_button.place(x=330,y=130)
510
511
512
513#button to test pupils
514pupil_knowledge_button = Button(menu_frame,text='Test on ski safety ',command = studenttest_menu,font = ('bold',10),pady=10,padx=250,width=10)
515pupil_knowledge_button.place(x=330,y=180)
516
517
518
519#button to enter the ski times of a pupil
520ski_time_button=Button(menu_frame,text='Enter the skii times of the students',command = ski_time_menu,font = ('bold',10),pady=10,padx=250,width=10)
521ski_time_button.place(x=330,y=230)
522
523
524
525#button to display the average ski time of a student
526average_time_button=Button(menu_frame,text='Find the average ski time of students',command = average_time_menu,font = ('bold',10),pady=10,padx=250,width=10)
527average_time_button.place(x=330,y=280)
528
529
530#button to show the level of skiing of each student
531pupil_group_button=Button(menu_frame,text='The group level of each student',command = pupil_group_menu,font = ('bold',10),pady=10,padx=250,width=10)
532pupil_group_button.place(x=330,y=330)
533
534
535
536#help button
537menu_helpbutton=Button(menu_frame,text='Help?',command= help_menu,bg='#c0c5ce',font = ('bold',10),pady=10,padx=250,width=10)
538menu_helpbutton.place(x=330,y=380)
539
540
541#************************************************************************************************************************************
542#components of the adding pupil frame
543#************************************************************************************************************************************
544
545
546#frame for adding pupils details
547#initialise variables for pupilentry_frame
548firstname = StringVar()
549surname = StringVar()
550pupil_email = StringVar()
551emailtype = StringVar()
552postcode = StringVar()
553address1 = StringVar()
554address2 = StringVar()
555yeargroup = StringVar()
556parents_contactnumber = StringVar()
557medical_condition = StringVar()
558
559#we associate intvar with radio buttons
560gender = IntVar()
561
562#row1
563#creating a label for the heading
564add_pupildetails_title=Label(pupilentry_frame,text="Add pupil's details",bg='#dfe3ee',font=('bold',48))
565add_pupildetails_title.place(x=370,y=1)
566#add_pupildetails_title.grid(row=1,column=4,columnspan=4,sticky='nesw')
567
568#back button
569detail_back_button=Button(pupilentry_frame,text='Back',command = back_button_details,bg='#c0c5ce' , font = ('bold',32) )
570detail_back_button.place(x=1,y=1)
571
572
573#row2
574#creating a label
575firstname_detail_label=Label(pupilentry_frame,text='Firstname',bg='#dfe3ee',font=('bold',15),padx=250,width=15)
576firstname_detail_label.place(x=100,y=95)
577
578#creating a entrybox
579firstname_entry=Entry(pupilentry_frame,textvariable=firstname,bg='white',font=('bold',15),width=20)
580firstname_entry.place(x=650,y=95)
581
582#row3
583#creating a label
584surname_label=Label(pupilentry_frame,text='Surname',bg='#dfe3ee',font=('bold',15),pady=5,padx=250,width=15)
585surname_label.place(x=100,y=125)
586
587
588#creating a entrybox
589surname_entry=Entry(pupilentry_frame,textvariable=surname,bg='white',font=('bold',15),width=20 )
590surname_entry.place(x=650,y=130)
591
592
593#row4
594#creating a label
595gender_label=Label(pupilentry_frame,text='Gender',bg='#dfe3ee',font=('bold',15),pady=5,padx=250,width=15)
596gender_label.place(x=100,y=160)
597
598
599#radio buttons for male and female stopping any spelling mistakes
600male_gender_button=Radiobutton(pupilentry_frame,text= 'Male',bg='#dfe3ee',font=('bold',15),variable = gender, value=1,pady=5,width=7)
601male_gender_button.place(x=630,y=160)
602
603female_gender_button=Radiobutton(pupilentry_frame,text='Female',bg='#dfe3ee',font=('bold',15),variable =gender,value=2,width=9,pady=5)
604female_gender_button.place(x=745,y=160)
605#row5
606#creating a label
607
608email_label=Label(pupilentry_frame,text=' Pupil email',bg='#dfe3ee',font=('bold',15),pady=5,padx=250,width=15)
609email_label.place(x=100,y=195)
610
611#creating a entry to enter the first part of the email
612email_entry=Entry(pupilentry_frame,textvariable=pupil_email ,bg='white',font=('bold',15),width=10 )
613email_entry.place(x=650,y=200)
614
615#Created a dictionary with all options
616email_choices ={'@gmail.com','@hotmail.com','@mail.com','@yahoo.com'}
617#set the variable email to show @gmail.com everytime
618#EMAIL.SET
619emailtype.set('@gmail.com')
620popmenu_email = OptionMenu(pupilentry_frame,emailtype,*email_choices )
621popmenu_email.config(width=10)
622popmenu_email.place(x=765,y=198)
623
624#row6
625#creating a label
626
627postcode_label=Label(pupilentry_frame,text='Postcode',bg='#dfe3ee',font=('bold',15),pady=5,padx=250,width=15)
628postcode_label.place(x=100,y=230)
629
630#creating a entrybox
631
632postcode_entry=Entry(pupilentry_frame,textvariable=postcode,bg='white',font=('bold',15),width=20 )
633postcode_entry.place(x=650,y=235)
634#row7
635#address1
636
637address1_label=Label(pupilentry_frame,text='Address1',bg='#dfe3ee',font=('bold',15),pady=5,padx=250,width=15)
638address1_label.place(x=100,y=265)
639
640#creating a entry box
641address1_entry=Entry(pupilentry_frame,textvariable = address1,bg='white',font=('bold',15),width=20 )
642address1_entry.place(x=650,y=270)
643
644#row8
645address2_label=Label(pupilentry_frame,text='Address2',bg='#dfe3ee',font=('bold',15),pady=5,padx=250,width=15)
646address2_label.place(x=100,y=300)
647
648
649#creating a entry box
650address2_entry=Entry(pupilentry_frame,textvariable = address2,bg='white',font=('bold',15),width=20)
651address2_entry.place(x=650,y=305)
652
653
654#row9
655#creating a label
656yeargroup_label=Label(pupilentry_frame,text='Year group',bg='#dfe3ee',font=('bold',15),pady=10,padx=250,width=15)
657yeargroup_label.place(x=100,y=335)
658
659#creating a dictionary with all of the option
660yeargroup_choices ={'Year8','Year9','Year10','Year11','Year12','Year13','Year14'}
661#setting the year group to Year10
662yeargroup.set('Year8')
663popmenu_year = OptionMenu(pupilentry_frame,yeargroup,*yeargroup_choices)
664popmenu_year.config( width = 10,pady=5)
665popmenu_year.place(x=765,y=340)
666
667
668#row10
669#creating label
670age_label=Label( pupilentry_frame,text='Age',bg='#dfe3ee',font=('bold',15),pady=10,padx=250 , width=15)
671age_label.place(x=100,y=370)
672
673#creating spinbox
674age_spin=Spinbox( pupilentry_frame,from_ = 11 ,to =18,width =5,font=('bold',15))
675age_spin.place(x=795,y=375)
676
677#row11
678#creating a label
679
680parents_telephone_label=Label(pupilentry_frame,text="Parent's telephone number",bg='#dfe3ee',font=('bold',15),pady=10,padx=250 , width=15)
681parents_telephone_label.place(x=100,y=405)
682
683#creating a entrybox
684
685parents_telephone_entry=Entry(pupilentry_frame,textvariable=parents_contactnumber ,bg='white',font=('bold',15),width=20 )
686parents_telephone_entry.place(x=650,y=410)
687
688#row12
689#creating a label
690conditions_label=Label(pupilentry_frame,text="Medical Conditions",bg='#dfe3ee',font=('bold',15),pady=10,padx=250 , width=15)
691conditions_label.place(x=100,y=440)
692
693#creating a dictionary with all of the option
694conditions_choices ={'None','Asthma','Diabetes','Arthritis','High blood pressure'}
695#setting the year group to Year10
696medical_condition.set('None')
697popmenu_health = OptionMenu(pupilentry_frame,medical_condition,*conditions_choices )
698popmenu_health.config (width = 10,pady=5)
699popmenu_health.place(x=765,y=445)
700
701#row13
702#submit button
703detailsubmit_button=Button(pupilentry_frame,text='submit',width=15,bg='#FF338D',command = submit_details ,font=('bold',20) )
704detailsubmit_button.place(x=625,y=500 )
705
706#clearbutton + question box
707detail_clearbutton=Button(pupilentry_frame,text='Clear',width=5,bg='#c0c5ce',command = clear_detail and clear_warning ,font=('bold',20))
708detail_clearbutton.place(x=500,y=500)
709
710#help button
711help_detail_button=Button(pupilentry_frame,text='Help',width=5,bg='#c0c5ce',command = help_detail ,font=('bold',20) )
712help_detail_button.place(x=400,y=500 )
713
714
715#image for pupil entry frame
716#making a canvas and is where the image is going to be placed
717canvas = Canvas(pupilentry_frame,width=190, height=370, bg = "#dfe3ee")
718canvas.place(x=980,y=130)
719
720#The image
721my_image = PhotoImage(file="skiing_detail.png")
722
723#Putting the image on the canvas
724canvas.create_image(0,0, anchor = NW, image=my_image)
725canvas.my_image = my_image
726
727
728
729
730
731
732#************************************************************************************************************************************
733#components for adding ski time
734#************************************************************************************************************************************
735
736
737student_id_times = StringVar()
738
739
740
741#line one
742#title
743add_pupil_time_title=Label(skitimes_frame,text="Add pupil's ski times",bg='#dfe3ee',font=('bold',48))
744add_pupil_time_title.place(x=370,y=1)
745
746#back button
747times_back_button=Button(skitimes_frame,text='Back',command = back_button_times,bg='#c0c5ce', font = ('bold',32) )
748times_back_button.place(x=1,y=1)
749
750
751#line 2
752#label
753pupil_id_time_label=Label( skitimes_frame,text='Pupil Id',bg='#dfe3ee',font=('bold',15),padx=250,width=15)
754pupil_id_time_label.place(x=150,y=100)
755
756#creating a entrybox
757
758pupil_id_time_entry=Entry(skitimes_frame,textvariable=student_id_times,bg='white',font=('bold',15),width=15)
759pupil_id_time_entry.place(x=565,y=100)
760
761#check button to see if id is valid and exist
762times_check_button=Button(skitimes_frame,text='check',command = check_button_times,bg='#c0c5ce' , font = ('bold',10),width=10 )
763times_check_button.place(x=765,y=98)
764
765#line3
766#First name label
767firstname_times_label=Label(skitimes_frame,text='Firstname',bg='#dfe3ee',font=('bold',15),padx=250,width=15)
768firstname_times_label.place(x=150,y=135)
769
770#here we call the function raise_frame to bring the login_frame to view
771raise_frame(entry_frame)
772
773#here is where the program begins
774root.mainloop()