-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWindow.py
More file actions
158 lines (111 loc) · 6.05 KB
/
Copy pathWindow.py
File metadata and controls
158 lines (111 loc) · 6.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
from tkinter import *
from tkinter import messagebox
from Classes import *
from WindowProcedures import *
class Window(Frame): #Creates the Main Menu, each function from then on creates another window for the user to interact with.
def __init__(self, master):
Frame.__init__(self, master)
self.menuWindow()
def menuWindow(self):
self.grid()
buttonList = []
lblTitle = Label(self, text = "Main Menu", font=("Helvetica", 40,"bold"))
lblTitle.grid(row=1, column=0, columnspan=2, padx=(50, 50), pady=(20,20))
butImport = Button(self, text="Import CSV file", font=("Helvetica", 10), command= lambda: importFunc(entCSV.get(), buttonList))
butImport.grid(row=3, column=1, pady=(2, 0))
entCSV = Entry(self, font=("Helvetica", 10))
entCSV.grid(row = 3, column = 0)
butSearch = Button(self, text="Search for Student", font=("Helvetica", 10), state=DISABLED, command = self.searchWindow)
butSearch.grid(row=4, column=0, columnspan = 2, pady=(2, 0))
butDisplay = Button(self, text="Display Students by Tutor", font=("Helvetica", 10), state=DISABLED, command = self.searchTutorWindow)
butDisplay.grid(row=5, column=0, columnspan = 2, pady=(2, 0))
butFind = Button(self, text="Find Tutor Quota", font=("Helvetica", 10), state=DISABLED, command=self.quotaWindow)
butFind.grid(row=6, column=0, columnspan = 2, pady=(2, 0))
butTransfer = Button(self, text="Transfer Student", font=("Helvetica", 10), state=DISABLED, command = self.managementWindow)
butTransfer.grid(row=8, column=0, columnspan = 2, pady=(2, 0))
butQuit = Button(self, text="Quit", font=("Helvetica", 10), command=self.quit)
butQuit.grid(row=10, column=0, columnspan = 2, pady=(20, 10))
buttonList = [butSearch, butDisplay, butFind, butTransfer]
def quotaWindow(self):
global Tutors
labels = []
buttons = []
t = Toplevel(self)
t.wm_title("Quota Info")
t.grid()
lblTitle = Label(t, text = "Tutor Quota", font=("Helvetica", 40,"bold"))
lblTitle.grid(row=1, column=0, columnspan=1, padx=(50, 50), pady=(20,20))
for tutor in Tutors:
myString = ("Name: " + tutor.getFName() + " " + tutor.getSName() + " | Total Students: " + str(len(tutor.getStudents())) + "/" + str(tutor.getStudentNum()) + " | Email Address: " + tutor.getEmail())
labels.append(Label(t, text = myString, font=("Helvetica", 10, "bold")))
labels[-1].grid(row=(3 + Tutors.index(tutor)), column=0, columnspan=1, padx=(50, 50), pady=(20, 20))
def searchWindow(self):
t = Toplevel(self)
t.wm_title("Search Student")
t.grid()
lblTitle = Label(t, text = "Search for Students by ID", font=("Helvetica", 20,"bold"))
lblTitle.grid(row=0, column=0, columnspan=2, padx=(20, 20), pady=(20,20))
entID = Entry(t, font=("Helvetica", 10))
entID.grid(row = 1, column = 0)
lblTrue = Label(t, text = "", font=("Helvetica", 8,"bold"))
lblTrue.grid(row=4, column=0, columnspan=2, padx=(20, 20), pady=(20,20))
butSearch = Button(t, text="Search", font=("Helvetica", 10), command = lambda: searchByStudentID(entID.get(), lblTrue))
butSearch.grid(row=1, column=1, pady=(0, 0))
def searchTutorWindow(self):
t = Toplevel(self)
t.wm_title("Search Tutor")
t.grid()
lblTitle = Label(t, text = "Search for Students by Tutor ID", font=("Helvetica", 20,"bold"))
lblTitle.grid(row=0, column=0, columnspan=5, padx=(20, 20), pady=(20,20))
entID = Entry(t, font=("Helvetica", 10))
entID.grid(row = 1, column = 0)
t.listStudent = Listbox(t, height= 3, width = 30)
scroll = Scrollbar(t, command= t.listStudent.yview)
t.listStudent.configure(yscrollcommand=scroll.set)
t.listStudent.grid(row=1, column=4, columnspan = 2)
scroll.grid(row=1, column=5, columnspan = 1, sticky = E)
butSearch = Button(t, text="Search", font=("Helvetica", 10), command = lambda: SearchByTutorID(entID.get(), t.listStudent))
butSearch.grid(row=1, column=3, pady=(0, 0))
def managementWindow(self):
t = Toplevel(self)
t.wm_title("Student Management")
t.grid()
lblTitle = Label(t, text = "Student Management", font=("Helvetica", 30,"bold"))
lblTitle.grid(row=1, column=0, columnspan=3, padx=(50, 50), pady=(20,20))
lblProg = Label(t, text='Students:', font=('Helvetica', 12))
lblProg.grid(row=3, column=0, sticky = E, columnspan = 1)
entID = Entry(t, font=("Helvetica", 10))
entID.grid(row = 3, column = 1)
butReassign = Button(t, text="Reassign Student", font=("Helvetica", 10), command =lambda: self.reasignWindow(entID.get()))
butReassign.grid(row=5, column=1, pady=(2, 0))
butDelete = Button(t, text="Delete Student", font=("Helvetica", 10), command = lambda: studentDelete(entID.get()))
butDelete.grid(row=4, column=1, pady=(2, 0))
def reasignWindow(self, studentID):
u = Toplevel(self)
u.wm_title("Student Management")
u.grid()
u.listProg = Listbox(u, height= 3, width = 30)
scroll = Scrollbar(u, command= u.listProg.yview)
u.listProg.configure(yscrollcommand=scroll.set)
u.listProg.grid(row=0, column=1, columnspan = 2, rowspan = 2)
scroll.grid(row=0, column=2, columnspan = 2, sticky = E)
student = getStudentFromID(studentID)
for Tutor in Tutors:
u.listProg.insert(END, Tutor.getFName() + " " + Tutor.getSName() + ": " + Tutor.getId())
u.listProg.selection_set(END)
entID = Entry(u, font=("Helvetica", 10))
entID.grid(row = 2, column = 1)
lblProg = Label(u, text='Available Tutors: ', font=('Helvetica', 10,'bold'))
lblProg.grid(row=0, column=0, columnspan = 1)
lblHelp = Label(u, text='Input Staff ID for transfer: ', font=('Helvetica', 10,'bold'))
lblHelp.grid(row=2, column=0, columnspan = 1)
butReassign = Button(u, text="Reassign Student", font=("Helvetica", 10), command = lambda: matchTutor(student, getTutorFromID(entID.get())))
butReassign.grid(row=2, column=2, pady=(0, 0))
def main(): #defining the start of the code and calling Window()
root = Tk()
root.title("Tutor Management Software")
root.resizable(False, False)
app = Window(root)
root.mainloop()
if __name__ == "__main__":
main()