Advertisement
Guest User

Untitled

a guest
Mar 5th, 2017
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.13 KB | None | 0 0
  1. from tkinter import Tk, StringVar, ttk, messagebox
  2. from tkinter import*
  3. import time;
  4.  
  5. usrName = ""
  6. logInStatus = False
  7.  
  8. def logMeIn():
  9. window=Tk()
  10. l1 =Label(window,text='username: ')
  11. l2 =Label(window,text='password: ')
  12. t1 =Entry(window,textvariable=StringVar())
  13. t2 =Entry(window,show='*',textvariable=StringVar())
  14.  
  15. def authorisation():
  16.  
  17. username = t1.get()
  18. global usrName
  19. usrName = username
  20. password=t2.get()
  21. global logInStatus
  22.  
  23. if(username=='T170555') and (password=='0000'):
  24. print('you have successfully logged in')
  25. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  26. logInStatus = True
  27. elif(username=='T170632') and (password=='0001'):
  28. print('you have successfully logged in')
  29. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  30. logInStatus = True
  31. elif(username=='S170300') and (password=='0002'):
  32. print('you have successfully logged in')
  33. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  34. logInStatus = True
  35. elif(username=='S170301') and (password=='0003'):
  36. print('you have successfully logged in')
  37. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  38. logInStatus = True
  39. elif(username=='S170302') and (password=='0004'):
  40. print('you have successfully logged in')
  41. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  42. logInStatus = True
  43. elif(username=='S170303') and (password=='0005'):
  44. print('you have successfully logged in')
  45. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  46. logInStatus = True
  47. elif(username=='S170304') and (password=='0006'):
  48. print('you have successfully logged in')
  49. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  50. logInStatus = True
  51. elif(username=='S170305') and (password=='0007'):
  52. print('you have successfully logged in')
  53. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  54. logInStatus = True
  55. elif(username=='S170306') and (password=='0008'):
  56. print('you have successfully logged in')
  57. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  58. logInStatus = True
  59. elif(username=='S170307') and (password=='0009'):
  60. print('you have successfully logged in')
  61. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  62. logInStatus = True
  63. elif(username=='S170308') and (password=='0010'):
  64. print('you have successfully logged in')
  65. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  66. logInStatus = True
  67. elif(username=='S170309') and (password=='0011'):
  68. print('you have successfully logged in')
  69. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  70. logInStatus = True
  71. elif(username=='S170400') and (password=='0012'):
  72. print('you have successfully logged in')
  73. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  74. logInStatus = True
  75. elif(username=='S170401') and (password=='0013'):
  76. print('you have successfully logged in')
  77. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  78. logInStatus = True
  79. elif(username=='S170402') and (password=='0014'):
  80. print('you have successfully logged in')
  81. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  82. logInStatus = True
  83. elif(username=='S170403') and (password=='0015'):
  84. print('you have successfully logged in')
  85. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  86. logInStatus = True
  87. elif(username=='S170404') and (password=='0016'):
  88. print('you have successfully logged in')
  89. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  90. logInStatus = True
  91. elif(username=='S170405') and (password=='0017'):
  92. print('you have successfully logged in')
  93. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  94. logInStatus = True
  95. elif(username=='S170406') and (password=='0018'):
  96. print('you have successfully logged in')
  97. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  98. logInStatus = True
  99. elif(username=='S170407') and (password=='0019'):
  100. print('you have successfully logged in')
  101. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  102. logInStatus = True
  103. elif(username=='S170408') and (password=='0020'):
  104. print('you have successfully logged in')
  105. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  106. logInStatus = True
  107. elif(username=='S170409') and (password=='0021'):
  108. print('you have successfully logged in')
  109. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  110. logInStatus = True
  111. elif(username=='S170500') and (password=='0022'):
  112. print('you have successfully logged in')
  113. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  114. logInStatus = True
  115. elif(username=='S170501') and (password=='0023'):
  116. print('you have successfully logged in')
  117. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  118. logInStatus = True
  119. elif(username=='S170502') and (password=='0024'):
  120. print('you have successfully logged in')
  121. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  122. logInStatus = True
  123. elif(username=='S170503') and (password=='0025'):
  124. print('you have successfully logged in')
  125. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  126. logInStatus = True
  127. elif(username=='S170504') and (password=='0026'):
  128. print('you have successfully logged in')
  129. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  130. logInStatus = True
  131. elif(username=='S170505') and (password=='0027'):
  132. print('you have successfully logged in')
  133. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  134. logInStatus = True
  135. elif(username=='S170506') and (password=='0028'):
  136. print('you have successfully logged in')
  137. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  138. logInStatus = True
  139. elif(username=='S170507') and (password=='0029'):
  140. print('you have successfully logged in')
  141. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  142. logInStatus = True
  143. elif(username=='S170508') and (password=='0030'):
  144. print('you have successfully logged in')
  145. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  146. logInStatus = True
  147. elif(username=='S170509') and (password=='0031'):
  148. print('you have successfully logged in')
  149. messagebox.showinfo('Successful log in', 'you have successfully logged in')
  150. logInStatus = True
  151. else:
  152. print('details entered are incorrect, please try again')
  153. messagebox.showinfo('Unsucessful log in', 'details entered are incorrect, please try again')
  154. logInStatus = False
  155.  
  156. b1 =Button(window,text='log in',command=authorisation)
  157.  
  158. l1.pack()
  159. t1.pack()
  160. l2.pack()
  161. t2.pack()
  162. b1.pack()
  163.  
  164. window.mainloop()
  165.  
  166. def AttendanceResister():
  167. root = Tk()
  168. root.title("Attendance Register")
  169. root.configure(background='black')
  170. frame = Frame(root)
  171. frame.pack()
  172.  
  173. LFrame = Frame(root, width=1350, height=650, bd=8, relief="flat")
  174. LFrame.pack(fill=BOTH, expand=1)
  175.  
  176. LFrame0 = Frame(LFrame, width=1350, height=50, bd=8, relief="raise")
  177. LFrame0.pack(fill=X, side=TOP)
  178. LFrame1 = Frame(LFrame, width=1350, height=50, bd=8, relief="raise")
  179. LFrame1.pack(fill=X, side=TOP)
  180. LFrame2 = Frame(LFrame, width=1350, height=100, bd=8, relief="raise")
  181. LFrame2.pack(fill=X, side=TOP)
  182.  
  183. DateofOrder = StringVar()
  184. value0 = StringVar()
  185. value1 = StringVar()
  186. value2 = StringVar()
  187. value3 = StringVar()
  188. value4 = StringVar()
  189. value5 = StringVar()
  190. value6 = StringVar()
  191. value7 = StringVar()
  192. value8 = StringVar()
  193. value9 = StringVar()
  194. value10 = StringVar()
  195. value11 = StringVar()
  196. value12 = StringVar()
  197.  
  198. def Mark_Register():
  199. if value0.get() == "/":
  200. value1.set("/")
  201. value2.set("/")
  202. value3.set("/")
  203. value4.set("/")
  204. value5.set("/")
  205. value6.set("/")
  206. value7.set("/")
  207. value8.set("/")
  208. value9.set("/")
  209. value10.set("/")
  210. value11.set("/")
  211. value12.set("/")
  212. elif (value0.get() == "Late"):
  213. value1.set("Late")
  214. value2.set("Late")
  215. value3.set("Late")
  216. value4.set("Late")
  217. value5.set("Late")
  218. value6.set("Late")
  219. value7.set("Late")
  220. value8.set("Late")
  221. value9.set("Late")
  222. value10.set("Late")
  223. value11.set("Late")
  224. value12.set("Late")
  225. elif (value0.get() == "Presence"):
  226. value1.set("Presence")
  227. value2.set("Presence")
  228. value3.set("Presence")
  229. value4.set("Presence")
  230. value5.set("Presence")
  231. value6.set("Presence")
  232. value7.set("Presence")
  233. value8.set("Presence")
  234. value9.set("Presence")
  235. value10.set("Presence")
  236. value11.set("Presence")
  237. value12.set("Presence")
  238. elif (value0.get() == "Excused"):
  239. value1.set("Excused")
  240. value2.set("Excused")
  241. value3.set("Excused")
  242. value4.set("Excused")
  243. value5.set("Excused")
  244. value6.set("Excused")
  245. value7.set("Excused")
  246. value8.set("Excused")
  247. value9.set("Excused")
  248. value10.set("Excused")
  249. value11.set("Excused")
  250. value12.set("Excused")
  251.  
  252. def Reset():
  253. value0.set("")
  254. value1.set("")
  255. value2.set("")
  256. value3.set("")
  257. value4.set("")
  258. value5.set("")
  259. value6.set("")
  260. value7.set("")
  261. value8.set("")
  262. value9.set("")
  263. value10.set("")
  264. value11.set("")
  265. value12.set("")
  266.  
  267. def qExit():
  268. qExit = messagebox.askyesno("Exit system", "Do you want to quit")
  269. if qExit > 0:
  270. root.destroy()
  271. return
  272.  
  273. DateofOrder.set(time.strftime("%d/%m/%Y"))
  274.  
  275. Header = Label(LFrame0, font=('courier', 14, 'bold'), text="Class A Attendance", bd=15)
  276. Header.pack(fill=X, expand=1)
  277. lStudentNo = Label(LFrame1, font=('courier', 14, 'bold'), text="Student No.", bd=15)
  278. lStudentNo.grid(row=0, column=1, sticky=W)
  279. lStudentName = Label(LFrame1, font=('courier', 14, 'bold'), text="Student Name", bd=15)
  280. lStudentName.grid(row=0, column=2, sticky=W)
  281. lCourseCode = Label(LFrame1, font=('courier', 14, 'bold'), text="Course Code ", bd=15)
  282. lCourseCode.grid(row=0, column=3, sticky=W)
  283.  
  284. box = ttk.Combobox(LFrame1, textvariable=value0, state='readonly')
  285. box['values'] = (' ', 'Late', 'Presence', 'Excused')
  286. box.current(0)
  287. box.grid(row=0, column=4)
  288. DateofOrder.set(time.strftime("%d/%m/%Y"))
  289. btnFill = Button(LFrame1, text='Fill', padx=2, pady=2, bd=15, fg="black",
  290. font=('arial', 10, 'bold'), width=12, height=1, command=Mark_Register).grid(row=0, column=5)
  291. btnReset = Button(LFrame1, text='Reset', padx=2, pady=2, bd=15, fg="black",
  292. font=('arial', 10, 'bold'), width=12, height=1, command=Reset).grid(row=0, column=6)
  293. btnExit = Button(LFrame1, text='Exit', padx=2, pady=2, bd=15, fg="black",
  294. font=('arial', 10, 'bold'), width=12, height=1, command=qExit).grid(row=0, column=7)
  295. # -------------------------------------------------------------------------------------------------------
  296. DateofOrder = Label(LFrame1, font=('arial', 10, 'bold'), textvariable=DateofOrder, padx=2,
  297. pady=2, bd=2, fg="black", bg='white', relief='sunken')
  298. DateofOrder.grid(row=0, column=8, sticky=W)
  299.  
  300. StudentNo1 = Label(LFrame2, font=('courier', 14, 'bold'), text="S170300", padx=2,
  301. pady=2, bd=15, fg="black", width=12)
  302. StudentNo1.grid(row=0, column=1, sticky=W)
  303. Student_Name = Label(LFrame2, font=('courier', 14, 'bold'), text="Alice Butler", padx=2,
  304. pady=2, bd=15, fg="black", width=12)
  305. Student_Name.grid(row=0, column=2, sticky=W)
  306. Course_Code = Label(LFrame2, font=('courier', 14, 'bold'), text="Course Code", padx=2,
  307. pady=2, bd=15, fg="black", width=12)
  308. Course_Code.grid(row=0, column=3, sticky=W)
  309.  
  310. box = ttk.Combobox(LFrame2, textvariable=value0, state='readonly')
  311. box['values'] = (' ', 'Late', 'Presence', 'Excused')
  312. box.current(0)
  313. box.grid(row=0, column=4)
  314.  
  315. Label(LFrame2, text="Enter Excused Reason").grid(row=0, column=5)
  316.  
  317. E1 = Entry(LFrame2)
  318. E1.grid(row=0, column=6)
  319. # ---------------------------------------------------------------------------------------------
  320. StudentNo1 = Label(LFrame2, font=('courier', 14, 'bold'), text="S170301", padx=2,
  321. pady=2, bd=15, fg="black", width=12)
  322. StudentNo1.grid(row=1, column=1, sticky=W)
  323. Student_Name = Label(LFrame2, font=('courier', 14, 'bold'), text="Aaron Keller", padx=2,
  324. pady=2, bd=15, fg="black", width=12)
  325. Student_Name.grid(row=1, column=2, sticky=W)
  326. Course_Code = Label(LFrame2, font=('courier', 14, 'bold'), text="Course Code", padx=2,
  327. pady=2, bd=15, fg="black", width=12)
  328. Course_Code.grid(row=1, column=3, sticky=W)
  329.  
  330. box = ttk.Combobox(LFrame2, textvariable=value0, state='readonly')
  331. box['values'] = (' ', 'Late', 'Presence', 'Excused')
  332. box.current(0)
  333. box.grid(row=1, column=4)
  334.  
  335. Label(LFrame2, text="Enter Excused Reason").grid(row=1, column=5)
  336.  
  337. E1 = Entry(LFrame2)
  338. E1.grid(row=1, column=6)
  339. # ------------------------------------------------------------------------------------------------------
  340. StudentNo1 = Label(LFrame2, font=('courier', 14, 'bold'), text="S170302", padx=2,
  341. pady=2, bd=15, fg="black", width=12)
  342. StudentNo1.grid(row=2, column=1, sticky=W)
  343. Student_Name = Label(LFrame2, font=('courier', 14, 'bold'), text="Noel MacGuire", padx=2,
  344. pady=2, bd=15, fg="black", width=12)
  345. Student_Name.grid(row=2, column=2, sticky=W)
  346. Course_Code = Label(LFrame2, font=('courier', 14, 'bold'), text="Course Code", padx=2,
  347. pady=2, bd=15, fg="black", width=12)
  348. Course_Code.grid(row=2, column=3, sticky=W)
  349.  
  350. box = ttk.Combobox(LFrame2, textvariable=value0, state='readonly')
  351. box['values'] = (' ', 'Late', 'Presence', 'Excused')
  352. box.current(0)
  353. box.grid(row=2, column=4)
  354.  
  355. Label(LFrame2, text="Enter Excused Reason").grid(row=2, column=5)
  356.  
  357. E1 = Entry(LFrame2)
  358. E1.grid(row=2, column=6)
  359. # ----------------------------------------------------------------------------------------
  360. StudentNo1 = Label(LFrame2, font=('courier', 14, 'bold'), text="S170303", padx=2,
  361. pady=2, bd=15, fg="black", width=12)
  362. StudentNo1.grid(row=3, column=1, sticky=W)
  363. Student_Name = Label(LFrame2, font=('courier', 14, 'bold'), text="Rene Mccarthy", padx=2,
  364. pady=2, bd=15, fg="black", width=12)
  365. Student_Name.grid(row=3, column=2, sticky=W)
  366. Course_Code = Label(LFrame2, font=('courier', 14, 'bold'), text="Course Code", padx=2,
  367. pady=2, bd=15, fg="black", width=12)
  368. Course_Code.grid(row=3, column=3, sticky=W)
  369.  
  370. box = ttk.Combobox(LFrame2, textvariable=value0, state='readonly')
  371. box['values'] = (' ', 'Late', 'Presence', 'Excused')
  372. box.current(0)
  373. box.grid(row=3, column=4)
  374.  
  375. Label(LFrame2, text="Enter Excused Reason").grid(row=3, column=5)
  376.  
  377. E1 = Entry(LFrame2)
  378. E1.grid(row=3, column=6)
  379. # ----------------------------------------------------------------------------------------
  380. StudentNo1 = Label(LFrame2, font=('courier', 14, 'bold'), text="S170304", padx=2,
  381. pady=2, bd=15, fg="black", width=12)
  382. StudentNo1.grid(row=4, column=1, sticky=W)
  383. Student_Name = Label(LFrame2, font=('courier', 14, 'bold'), text="Margret Nelson", padx=2,
  384. pady=2, bd=15, fg="black", width=12)
  385. Student_Name.grid(row=4, column=2, sticky=W)
  386. Course_Code = Label(LFrame2, font=('courier', 14, 'bold'), text="Course Code", padx=2,
  387. pady=2, bd=15, fg="black", width=12)
  388. Course_Code.grid(row=4, column=3, sticky=W)
  389.  
  390. box = ttk.Combobox(LFrame2, textvariable=value0, state='readonly')
  391. box['values'] = (' ', 'Late', 'Presence', 'Excused')
  392. box.current(0)
  393. box.grid(row=4, column=4)
  394.  
  395. Label(LFrame2, text="Enter Excused Reason").grid(row=4, column=5)
  396.  
  397. E1 = Entry(LFrame2)
  398. E1.grid(row=4, column=6)
  399. # ---------------------------------------------------------------------------------------
  400. StudentNo1 = Label(LFrame2, font=('courier', 14, 'bold'), text="S170305", padx=2,
  401. pady=2, bd=15, fg="black", width=12)
  402. StudentNo1.grid(row=5, column=1, sticky=W)
  403. Student_Name = Label(LFrame2, font=('courier', 14, 'bold'), text="Angelina Norton", padx=2,
  404. pady=2, bd=15, fg="black", width=12)
  405. Student_Name.grid(row=5, column=2, sticky=W)
  406. Course_Code = Label(LFrame2, font=('courier', 14, 'bold'), text="Course Code", padx=2,
  407. pady=2, bd=15, fg="black", width=12)
  408. Course_Code.grid(row=5, column=3, sticky=W)
  409.  
  410. box = ttk.Combobox(LFrame2, textvariable=value0, state='readonly')
  411. box['values'] = (' ', 'Late', 'Presence', 'Excused')
  412. box.current(0)
  413. box.grid(row=5, column=4)
  414.  
  415. Label(LFrame2, text="Enter Excused Reason").grid(row=5, column=5)
  416.  
  417. E1 = Entry(LFrame2)
  418. E1.grid(row=5, column=6)
  419. # --------------------------------------------------------------------------------------------
  420. StudentNo1 = Label(LFrame2, font=('courier', 14, 'bold'), text="S170306", padx=2,
  421. pady=2, bd=15, fg="black", width=12)
  422. StudentNo1.grid(row=6, column=1, sticky=W)
  423. Student_Name = Label(LFrame2, font=('courier', 14, 'bold'), text="Christopher Reese", padx=2,
  424. pady=2, bd=15, fg="black", width=12)
  425. Student_Name.grid(row=6, column=2, sticky=W)
  426. Course_Code = Label(LFrame2, font=('courier', 14, 'bold'), text="Course Code", padx=2,
  427. pady=2, bd=15, fg="black", width=12)
  428. Course_Code.grid(row=6, column=3, sticky=W)
  429.  
  430. box = ttk.Combobox(LFrame2, textvariable=value0, state='readonly')
  431. box['values'] = (' ', 'Late', 'Presence', 'Excused')
  432. box.current(0)
  433. box.grid(row=6, column=4)
  434.  
  435. Label(LFrame2, text="Enter Excused Reason").grid(row=6, column=5)
  436.  
  437. E1 = Entry(LFrame2)
  438. E1.grid(row=6, column=6)
  439. # ---------------------------------------------------------------------------------------------
  440. StudentNo1 = Label(LFrame2, font=('courier', 14, 'bold'), text="S170307", padx=2,
  441. pady=2, bd=15, fg="black", width=12)
  442. StudentNo1.grid(row=7, column=1, sticky=W)
  443. Student_Name = Label(LFrame2, font=('courier', 14, 'bold'), text="Nelson Rowe", padx=2,
  444. pady=2, bd=15, fg="black", width=12)
  445. Student_Name.grid(row=7, column=2, sticky=W)
  446. Course_Code = Label(LFrame2, font=('courier', 14, 'bold'), text="Course Code", padx=2,
  447. pady=2, bd=15, fg="black", width=12)
  448. Course_Code.grid(row=7, column=3, sticky=W)
  449.  
  450. box = ttk.Combobox(LFrame2, textvariable=value0, state='readonly')
  451. box['values'] = (' ', 'Late', 'Presence', 'Excused')
  452. box.current(0)
  453. box.grid(row=7, column=4)
  454.  
  455. Label(LFrame2, text="Enter Excused Reason").grid(row=7, column=5)
  456.  
  457. E1 = Entry(LFrame2)
  458. E1.grid(row=7, column=6)
  459. # --------------------------------------------------------------------------------------------
  460. StudentNo1 = Label(LFrame2, font=('courier', 14, 'bold'), text="S170308", padx=2,
  461. pady=2, bd=15, fg="black", width=12)
  462. StudentNo1.grid(row=8, column=1, sticky=W)
  463. Student_Name = Label(LFrame2, font=('courier', 14, 'bold'), text="Monica Smith", padx=2,
  464. pady=2, bd=15, fg="black", width=12)
  465. Student_Name.grid(row=8, column=2, sticky=W)
  466. Course_Code = Label(LFrame2, font=('courier', 14, 'bold'), text="Course Code", padx=2,
  467. pady=2, bd=15, fg="black", width=12)
  468. Course_Code.grid(row=8, column=3, sticky=W)
  469.  
  470. box = ttk.Combobox(LFrame2, textvariable=value0, state='readonly')
  471. box['values'] = (' ', 'Late', 'Presence', 'Excused')
  472. box.current(0)
  473. box.grid(row=8, column=4)
  474.  
  475. Label(LFrame2, text="Enter Excused Reason").grid(row=8, column=5)
  476.  
  477. E1 = Entry(LFrame2)
  478. E1.grid(row=8, column=6)
  479. # -----------------------------------------------------------------------------------------
  480. StudentNo1 = Label(LFrame2, font=('courier', 14, 'bold'), text="S170309", padx=2,
  481. pady=2, bd=15, fg="black", width=12)
  482. StudentNo1.grid(row=9, column=1, sticky=W)
  483. Student_Name = Label(LFrame2, font=('courier', 14, 'bold'), text="Allen Waters", padx=2,
  484. pady=2, bd=15, fg="black", width=12)
  485. Student_Name.grid(row=9, column=2, sticky=W)
  486. Course_Code = Label(LFrame2, font=('courier', 14, 'bold'), text="Course Code", padx=2,
  487. pady=2, bd=15, fg="black", width=12)
  488. Course_Code.grid(row=9, column=3, sticky=W)
  489.  
  490. box = ttk.Combobox(LFrame2, textvariable=value0, state='readonly')
  491. box['values'] = (' ', 'Late', 'Presence', 'Excused')
  492. box.current(0)
  493. box.grid(row=9, column=4)
  494.  
  495. Label(LFrame2, text="Enter Excused Reason").grid(row=9, column=5)
  496.  
  497. E1 = Entry(LFrame2)
  498. E1.grid(row=9, column=6)
  499.  
  500. root.mainloop()
  501.  
  502. def askForHelp():
  503. def datasave(event):
  504. fo = open("details.xls", "a+")
  505. fo.write("Teacher Name is:- "+str(v.get())+"\n"+"Student Message is :- "+input.get()+"\n");
  506.  
  507.  
  508. fo.close()
  509.  
  510. tkMessageBox.showinfo("Successfull","Message Sent")
  511. top = Tk()
  512. top.title("Help Access")
  513.  
  514. frame = Frame(width=250, height=300, bg="grey", colormap="new")
  515. frame.pack()
  516.  
  517.  
  518. teacher = Label(top, text="Teacher Name", bg="black", font=("arial", 15), fg="white")
  519. v = IntVar()
  520.  
  521. Radiobutton(top, text="Ryan Tucker", variable=v, value=1).pack()
  522. Radiobutton(top, text="Katherine Christensen", variable=v, value=2).pack()
  523.  
  524.  
  525. student = Label(top, text="Student's Feedback", bg="black", font=("arial", 15), fg="white")
  526. student.place(height=50, width=200, x=280, y=240)
  527. input = Entry(top)
  528. input.configure(width=40)
  529.  
  530. input.pack()
  531. teacher.pack()
  532. teacher.place(height=50, width=200, x=0, y=240)
  533. student.pack()
  534.  
  535. b=Button(top,text="Submit",bg="black",fg="white",font=("Arial",12))
  536. b.place(height="50",width="200")
  537. b.bind("<Button-1>",datasave)
  538.  
  539. b.pack()
  540. top.mainloop()
  541.  
  542. def gradesCalc():
  543. gpaCalculator = Tk() #Creating a window
  544. gpaCalculator.title("GPA Calculator")
  545. gpaCalculator.geometry("400x200+100+200")
  546. gpaCalculator.configure(background="Light Blue")
  547. button1=Button(gpaCalculator,text="Grade").grid(row=0)
  548. button2=Button(gpaCalculator,text="Credits").grid(row=1)
  549. button3= Button(gpaCalculator,text = "Course Title").grid(row=2)
  550. button4=Button(gpaCalculator,text = "Number of modules").grid(row=3)
  551. button5=Button(gpaCalculator,text = "GPA Result").grid(row=4)
  552. e1=Entry(gpaCalculator)#This will let the user input an entry of their grade
  553.  
  554. e2=Entry(gpaCalculator)
  555. e3=Entry(gpaCalculator)
  556. e4=Entry(gpaCalculator)
  557. e5=Entry(gpaCalculator)
  558.  
  559. e1.grid(row=0,column=2)
  560. e2.grid(row=1,column=2)
  561. e3.grid(row=2,column=2)
  562. e4.grid(row=3,column=2)
  563. e5.grid(row=4,column=2)
  564.  
  565. #this is the function which will be used to calculate the grade
  566. ## def grades(gpaCalculator):
  567. ## print("world")
  568. ## if grade=='A':
  569. ## return 4
  570. ## elif grade=='B':
  571. ## return 3
  572. ## elif grade=='C':
  573. ## return 2
  574. ## elif grade=='D':
  575. ## return 1
  576. ##
  577. ## gpaCalculator.mainloop()
  578.  
  579.  
  580.  
  581. def mainMenu(usrName):
  582.  
  583. usrNumList = list(usrName)
  584.  
  585. main_menu = Tk()
  586. frame = Frame(main_menu, width = 600, height = 720)
  587. main_menu.title("Main Menu")
  588.  
  589. def qExit():
  590. qExit = messagebox.askyesno("Exit system", "Do you want to quit")
  591. if qExit > 0:
  592. main_menu.destroy()
  593. return
  594.  
  595. if usrNumList[0] == "S":
  596. #Student mode
  597.  
  598. studentClass = ""
  599. if usrNumList[4] == "3":
  600. studentClass = "A"
  601. elif usrNumList[4] == "4":
  602. studentClass = "B"
  603. else:
  604. studentClass = "C"
  605.  
  606. txt = "Welcome, " + usrName+ " in class " + studentClass + ", select one of the options to continue"
  607. labelText = (txt)
  608. label = Label(main_menu, text = labelText, font = ("Arial", 20))
  609. label.grid(row = 0, column = 7)
  610.  
  611. #spacers
  612. label2 = Label(main_menu, text = " ", font = ("Arial", 20))
  613. label2.grid(row = 1, column = 5)
  614. label3 = Label(main_menu, text = " ", font = ("Arial", 20))
  615. label3.grid(row = 2, column = 5)
  616. label4 = Label(main_menu, text = " ", font = ("Arial", 20))
  617. label4.grid(row = 3, column = 5)
  618. label5 = Label(main_menu, text = " ", font = ("Arial", 20))
  619. label5.grid(row = 5, column = 5)
  620.  
  621. b1 = Button(main_menu, text = "View courses", font = ("Arial", 12))
  622. b1.grid(row = 4, column = 3)
  623. b1.config(height = 3, width = 10)
  624.  
  625. b2 = Button(main_menu, text = "Ask for help", font = ("Arial", 12), command = askForHelp)
  626. b2.grid(row = 4, column = 10)
  627. b2.config(height = 3, width = 10)
  628.  
  629. b3 = Button(main_menu, text = "View\n progress", font = ("Arial", 12), command = gradesCalc)
  630. b3.grid(row = 6, column = 3)
  631. b3.config(height = 3, width = 10)
  632.  
  633. b4 = Button(main_menu, text = "Log out", font = ("Arial", 12), command = qExit)
  634. b4.grid(row = 6, column = 10)
  635. b4.config(height = 3, width = 10)
  636. else:
  637. #Teacher mode
  638. labelText = "Welcome, " + usrName + ", select one of the options to contiue"
  639. label = Label(main_menu, text = labelText, font = ("Arial", 20))
  640. label.grid(row = 0, column = 7)
  641.  
  642. #spacers
  643. label2 = Label(main_menu, text = " ", font = ("Arial", 20))
  644. label2.grid(row = 1, column = 5)
  645. label3 = Label(main_menu, text = " ", font = ("Arial", 20))
  646. label3.grid(row = 2, column = 5)
  647. label4 = Label(main_menu, text = " ", font = ("Arial", 20))
  648. label4.grid(row = 3, column = 5)
  649. label5 = Label(main_menu, text = " ", font = ("Arial", 20))
  650. label5.grid(row = 5, column = 5)
  651.  
  652. b1 = Button(main_menu, text = "View results\n progress", font = ("Arial", 12))
  653. b1.grid(row = 4, column = 3)
  654. b1.config(height = 3, width = 10)
  655.  
  656. b2 = Button(main_menu, text = "View\n Attendance", font = ("Arial", 12))
  657. b2.grid(row = 4, column = 10)
  658. b2.config(height = 3, width = 10)
  659.  
  660. b3 = Button(main_menu, text = "Class\n Register", font = ("Arial", 12), command = AttendanceResister)
  661. b3.grid(row = 6, column = 3)
  662. b3.config(height = 3, width = 10)
  663.  
  664. b4 = Button(main_menu, text = "Log out", font = ("Arial", 12), command = qExit)
  665. b4.grid(row = 6, column = 10)
  666. b4.config(height = 3, width = 10)
  667.  
  668. main_menu.mainloop()
  669.  
  670.  
  671. def main():
  672. mainMenu("S170300")#Used for testing
  673. #logMeIn()
  674. #global logInStatus
  675. #global usrName
  676. #if logInStatus == True:
  677. #mainMenu(usrName)
  678.  
  679. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement