-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject.py
More file actions
210 lines (169 loc) · 8.97 KB
/
Project.py
File metadata and controls
210 lines (169 loc) · 8.97 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
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
from tkinter import *
from PIL import Image, ImageTk
from tkinter import messagebox
class PageSwitcherApp(Tk):
def __init__(self):
super().__init__()
self.title("Quiz App")
self.geometry("1540x1200")
self.config(bg="white")
self.page1 = Page1(self)
self.page2 = Page2(self)
self.page3 = page3(self)
self.page4 = page4(self)
self.page5 = page5(self)
self.page6 = page6(self)
self.page7 = page7(self)
self.page1.place(x=0, y=0, relwidth=1, relheight=1)
def show_page1(self):
self.page2.place_forget()
self.page3.place_forget()
self.page4.place_forget()
self.page5.place_forget()
self.page6.place_forget()
self.page7.place_forget()
self.page1.place(x=0, y=0, relwidth=1, relheight=1)
def show_page2(self):
self.page1.place_forget()
self.page3.place_forget()
self.page4.place_forget()
self.page5.place_forget()
self.page6.place_forget()
self.page7.place_forget()
self.page2.place(x=0, y=0, relwidth=1, relheight=1)
def show_page3(self):
self.page1.place_forget()
self.page2.place_forget()
self.page4.place_forget()
self.page5.place_forget()
self.page6.place_forget()
self.page7.place_forget()
self.page3.place(x=0, y=0, relwidth=1, relheight=1)
def show_page4(self):
self.page1.place_forget()
self.page2.place_forget()
self.page3.place_forget()
self.page5.place_forget()
self.page6.place_forget()
self.page7.place_forget()
self.page4.place(x=0,y=0,relwidth=1,relheight=1)
def show_page5(self):
self.page1.place_forget()
self.page2.place_forget()
self.page3.place_forget()
self.page4.place_forget()
self.page6.place_forget()
self.page7.place_forget()
self.page5.place(x=0,y=0,relwidth=1,relheight=1)
def show_page6(self):
self.page1.place_forget()
self.page2.place_forget()
self.page3.place_forget()
self.page5.place_forget()
self.page4.place_forget()
self.page7.place_forget()
self.page6.place(x=0,y=0,relwidth=1,relheight=1)
def show_page7(self):
self.page1.place_forget()
self.page2.place_forget()
self.page3.place_forget()
self.page5.place_forget()
self.page6.place_forget()
self.page4.place_forget()
self.page7.place(x=0,y=0,relwidth=1,relheight=1)
class Page1(Frame):
def __init__(self,master):
super().__init__(master)
self.configure(bg = "LightSkyBlue2")
f1=Frame(self,width=1600,height=600,bg='white',highlightbackground="LightSkyBlue4",highlightthickness=2)
f1.pack(pady=140,anchor=CENTER)
l1= Label(f1, text="BrainBooster : Quiz App",bg ="white", fg="black", font = ("Arial bold", 78),borderwidth=3, relief=RIDGE,padx=50,pady=40, anchor="center")
l1.place(x = 750, y = 220, anchor="center")
bt1 = Button(self, text="START",command=master.show_page3,activebackground="azure2", font=("Arial Bold", 20),bg="azure2",fg='Black',borderwidth=2, padx=40, pady=15)
bt1.place( x = 620, y=550,width=300,height=50)
bt2 = Button(self, text="Login/Register",command=master.show_page2, font=("Arial ", 20),background="azure2",borderwidth=2)
bt2.place(x = 1300, y = 50,width=200,height=50)
class Page2(Frame):
def __init__(self, master):
super().__init__(master)
self.config(bg="LightSkyBlue2")
def register():
name=nameVal.get()
Id=IdVal.get()
password=PasswordVal.get()
middle=MidVal.get()
if name=="":
messagebox.showerror("Error","Please Enter Your Name")
elif Id=="":
messagebox.showerror("Error","Please enter UserTd")
elif password=="":
messagebox.showerror("Error","Please enter Password")
elif middle=="":
messagebox.showerror("Error","Please enter Your Middle Name")
else:
Label(self,text="Registration Sucessful!!!",fg='green',font=("Calibri", 20)).place(x = 700,y = 730)
Button(self,text="Next",command=master.show_page3, bg="Gray",width=10, font=("Arial", 18), fg="white").place(x=820, y=680,anchor='center')
Frame(self,width=450,height=650,highlightbackground='green',highlightthickness=2 ).place(x=550,y=130)
Label(self, text=" Registration",fg ='green', font=("Calibri bold", 28),anchor='center').place(x=670,y=180)
Label(self, text="First Name",font=("Calibri", 20)).place(x=600, y=280)
Label(self, text="Last Name",font=("Calibri", 20)).place(x=600, y=370)
Label(self, text="User Id", font=("Calibri", 20)).place(x=600, y=460)
Label(self, text="Password", font=("Calibri", 20)).place(x=600, y=550)
nameVal = StringVar()
MidVal = StringVar()
IdVal = StringVar()
PasswordVal = StringVar()
self.nameEntry = Entry(self, textvariable=nameVal, bg="white", width=30, font=("Arial", 16, 'normal'))
self.nameEntry.place(x=605, y=325, height=25)
self.middleName = Entry(self, textvariable=MidVal, bg="white", width=30, font=("Arial", 16, 'normal'))
self.middleName.place(x=605, y=415, height=25)
self.UserId = Entry(self, textvariable=IdVal, bg="white", width=30, font=("Arial", 16, 'normal'))
self.UserId.place(x=605, y=505, height=25)
self.confPasswordEntry=Entry(self,textvariable=PasswordVal,bg="white",width=30, font=("Arial", 16, 'normal'),show='*')
self.confPasswordEntry.place(x=605,y=595,height=25)
Button(self, text="Login", command=register,width=10, font=("Arial", 18), bg="Green", fg="white").place(x=770, y=680,anchor='center')
Button(self,text="Back",command=master.show_page1,width=10, bg="azure2",font=("arial",16)).place(x=770, y=820,anchor='center')
class page3(Frame):
def __init__(self, master):
super().__init__(master)
self.config(bg="LightSkyBlue2")
Frame(self, width=900,height=500,highlightbackground='LightSkyBlue4',highlightthickness=2).place(x=340,y=150)
Label(self,text="Explore!",font=("arial",34,'bold')).place(x=720,y=230)
Button(self,text="Mathematics",command=master.show_page4,width=18,fg = "White",bg="purple",font=("arial",20)).place(x=450,y=350)
Button(self,text="Science",command=master.show_page5,width=18,fg = "White",bg="purple",font=("arial",20)).place(x=850,y=350)
Button(self,text="General Knowledge",command=master.show_page6,width=18,fg = "White",bg="purple",font=("arial",20)).place(x=450,y=450)
Button(self,text="Technical",command=master.show_page7,width=18,fg = "White",bg="purple",font=("arial",20)).place(x=850,y=450)
Button(self,text="Back",command=master.show_page1,width=10, bg="azure2",font=("arial",20)).place(x=800, y=580,anchor='center')
class page4(Frame):
def __init__(self,master):
super().__init__(master)
f2=Frame(self,width=900,height=500,bg='snow3',highlightbackground='Black',highlightthickness=2)
f2.place(x=320,y=150)
Label(self,text="What Symbol is used to symbolise percentage?",bg='snow3',font=("arial",24,'bold'),anchor='center').place(x=400,y=230)
# Button(self,text)
var=IntVar()
Radiobutton(self,text='/',variable=var,value=1,bg='white',width=30,font="Arial 14 bold",anchor='w').place(x=580,y=320)
Radiobutton(self,text="\\",variable=var,value=2,bg='white',width=30,font="Arial 14 bold",anchor='w').place(x=580,y=370)
Radiobutton(self,text='%',variable=var,value=3,bg='white',width=30,font="Arial 14 bold",anchor='w').place(x=580,y=420)
Radiobutton(self,text='$',variable=var,value=4,bg='white',width=30,font="Arial 14 bold",anchor='w').place(x=580,y=470)
class page5(Frame):
def __init__(self,master):
super().__init__(master)
self.config(bg="White")
Label(self,text="Explore5!",font=("arial",34,'bold')).place(x=720,y=230)
Button(self,text="Back",command=master.show_page3, bg="Gray",font=("Arial", 14,'bold'),fg='white').place(x=850, y=650,width=100, height=40)
class page6(Frame):
def __init__(self,master):
super().__init__(master)
self.config(bg="White")
Label(self,text="Explore6!",font=("arial",34,'bold')).place(x=720,y=230)
Button(self,text="Back",command=master.show_page3, bg="Gray",font=("Arial", 14,'bold'),fg='white').place(x=850, y=650,width=100, height=40)
class page7(Frame):
def __init__(self,master):
super().__init__(master)
self.config(bg="White")
Label(self,text="Explore7!",font=("arial",34,'bold')).place(x=720,y=230)
Button(self,text="Back",command=master.show_page3, bg="Gray",font=("Arial", 14,'bold'),fg='white').place(x=850, y=650,width=100, height=40)
if __name__== "__main__":
app = PageSwitcherApp()
app.mainloop()