-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathteacherCourseSelectionPage.py
195 lines (169 loc) · 5.77 KB
/
teacherCourseSelectionPage.py
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
from tkinter import *
from tkinter import ttk # ttk is used for styling
from PIL import Image, ImageTk
from tkinter import messagebox
import mysql.connector
from teacherMainPage import teacherMainPage
class teacherCourseSelection:
def __init__(self, root, data):
self.root = root
self.root.geometry("1550x900+0+0")
self.root.title("Face Recognition Attendance System")
self.mydata = data
# ======= Variables ============
self.var_year = StringVar()
self.var_sem = StringVar()
self.var_batch = StringVar()
self.var_course = StringVar()
# img1 = main background
img1 = Image.open("Images/Harvey.jpeg")
img1 = img1.resize((1550, 900), Image.ANTIALIAS)
self.photoimg1 = ImageTk.PhotoImage(img1)
bg_img = Label(self.root, image=self.photoimg1)
bg_img.place(x=0, y=0, width=1550, height=900)
# title
title_lbl = Label(
bg_img,
text="TEACHER COURSE SELECTION",
font=("times new roman", 25, "bold"),
bg="black",
fg="white",
)
title_lbl.place(x=510, y=160, width=500, height=40)
# teacherCourseSelection frame
teacherCourseSelection_frame = Frame(
bg_img, bd=2, bg="white", highlightthickness=5
)
teacherCourseSelection_frame.place(x=510, y=220, width=500, height=275)
teacherCourseSelection_frame.config(
highlightbackground="black", highlightcolor="black"
)
# Year label
year_label = Label(
teacherCourseSelection_frame,
text="Year",
font=("times new roman", 17),
bg="white",
)
year_label.place(x=50, y=50, anchor=NW)
# combo is used for dropdown like entering text
year_combo = ttk.Combobox(
teacherCourseSelection_frame,
textvariable=self.var_year,
font=("times new roman", 15),
state="readonly",
width=18,
)
year_combo["values"] = ("", "I", "II", "III", "IV")
year_combo.current(0) # to give the bydeafault index
year_combo.place(x=275, y=50, anchor=NW)
# Semester label
semester_label = Label(
teacherCourseSelection_frame,
text="Semester",
font=("times new roman", 17),
bg="white",
)
semester_label.place(x=50, y=100, anchor=NW)
# combo is used for dropdown like entering text
semester_combo = ttk.Combobox(
teacherCourseSelection_frame,
textvariable=self.var_sem,
font=("times new roman", 15),
state="readonly",
width=18,
)
semester_combo["values"] = (
"",
"I",
"II",
"III",
"IV",
"V",
"VI",
"VII",
"VIII",
)
semester_combo.current(0) # to give the bydeafault index
semester_combo.place(x=275, y=100, anchor=NW)
# Batch label
batch_label = Label(
teacherCourseSelection_frame,
text="Batch",
font=("times new roman", 17),
bg="white",
)
batch_label.place(x=50, y=150, anchor=NW)
# combo is used for dropdown like entering text
batch_combo = ttk.Combobox(
teacherCourseSelection_frame,
textvariable=self.var_batch,
font=("times new roman", 15),
state="readonly",
width=18,
)
batch_combo["values"] = ("", "2EE9", "2CS10", "2CS11", "2CS12")
batch_combo.current(0) # to give the bydeafault index
batch_combo.place(x=275, y=150, anchor=NW)
# course label
course_label = Label(
teacherCourseSelection_frame,
text="Course",
font=("times new roman", 17),
bg="white",
)
course_label.place(x=50, y=200, anchor=NW)
# combo is used for dropdown like entering text
course_combo = ttk.Combobox(
teacherCourseSelection_frame,
textvariable=self.var_course,
font=("times new roman", 15),
state="readonly",
width=18,
)
li = []
course_combo["values"] = (
"",
data[5],
data[6],
data[7],
)
course_combo.current(0) # to give the bydeafault index
course_combo.place(x=275, y=200, anchor=NW)
# ---- button ----#
# teacherCourseSelection button
teacherCourseSelection_btn = Button(
bg_img,
command=self.course_selection,
width=27,
height=2,
text="PROCEED",
font=("times new roman", 18, "bold"),
bg="white",
fg="black",
)
teacherCourseSelection_btn.place(x=650, y=520, anchor=NW)
################################3function =========================
def course_selection(self):
if (
self.var_course.get() == ""
or self.var_batch.get() == ""
or self.var_sem.get() == ""
or self.var_year.get() == ""
):
messagebox.showerror("Error", "All Fields are required", parent=self.root)
else:
data = [
self.var_year.get(),
self.var_sem.get(),
self.var_batch.get(),
self.var_course.get(),
]
self.new_window = Toplevel(
self.root
) # This asks where we want to open our window
self.app = teacherMainPage(self.new_window, data)
if __name__ == "__main__":
root = Tk()
obj = teacherCourseSelection(root)
root.mainloop()