forked from Nikhil-Sharma1/GNA-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsrv.py
214 lines (158 loc) · 6.31 KB
/
srv.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
from tkinter import *
from tkinter import ttk
import tkinter
root = Tk()
notebook = ttk.Notebook(root)
frame1 = ttk.Frame(notebook)
frame2 = ttk.Frame(notebook)
frame3 = ttk.Frame(notebook)
frame4 = ttk.Frame(notebook)
frame5 = ttk.Frame(notebook)
frame6 = ttk.Frame(notebook)
notebook.add(frame1, text="Q1")
notebook.add(frame2, text="Q2")
notebook.add(frame3, text="Q3")
notebook.add(frame4, text="Q4")
notebook.add(frame5, text="Q5")
notebook.add(frame6, text="Q6")
def displayscore(total):
score = Tk()
score.geometry("760x450")
score.title("Score")
score.configure(background="#000138")
Label(score, text="Your score is: ", fg="Black", font="Arial 36").pack()
T = Text(score, height=2, width=30 )
T.pack()
T.tag_configure("center", justify='center')
T.insert(tkinter.END,marks)
T.tag_add("center", "1.0", "end")
global ques,marks
ques=0
marks=0
def flagset():
global ques,marks
ques=ques+1
if ques == 6:
displayscore(marks)
def totalset():
global marks
marks=marks+1
def main():
def correct():
list = frame1.grid_slaves()
for l in list:
l.destroy()
Label(frame1, text="Correct").grid(row=1,column=5)
flagset()
totalset()
def incorrect():
list = frame1.grid_slaves()
for l in list:
l.destroy()
Label(frame1, text="Incorrect").grid(row=2,column=5)
flagset()
#Question 1
var = IntVar()
Label(frame1, text="Where is the '7' in 1704?").grid(row=2,column=3)
Button(frame1, text="In the Thousands", command=incorrect, width=15).grid(row=7, column=1)
Button(frame1, text="In the Hundreds", command=correct, width=15).grid(row=7, column=3)
Button(frame1, text="In the Tens", command=incorrect, width=15).grid(row=7, column=5)
Button(frame1, text="In the Ones", command=incorrect, width=15).grid(row=7, column=7)
def correct2():
list = frame2.grid_slaves()
for l in list:
l.destroy()
Label(frame2, text="Correct").grid(row=1,column=5)
flagset()
totalset()
def incorrect2():
list = frame2.grid_slaves()
for l in list:
l.destroy()
Label(frame2, text="Incorrect").grid(row=1,column=5)
flagset()
#Question2
Label(frame2, text="What is 1704 in words?").grid(row=2,column=3)
Button(frame2, text="One Million, Seven thousand and Four", command=incorrect2, width=35).grid(row=5,column=1)
Button(frame2, text="One Hundred and Seventy Four", command=incorrect2, width=35).grid(row=5, column=2)
Button(frame2, text="One Thousand and Seventy Four", command=incorrect2, width=35).grid(row=5, column=3)
Button(frame2, text="One Thousand, Seven Hundred and Four", command=correct2, width=35).grid(row=5, column=4)
#Question 3
def correct3():
list = frame3.grid_slaves()
for l in list:
l.destroy()
Label(frame3, text="Correct").grid(row=1,column=5)
flagset()
totalset()
def incorrect3():
list = frame3.grid_slaves()
for l in list:
l.destroy()
Label(frame3, text="Incorrect").grid(row=1,column=5)
flagset()
Label(frame3, text="Find ?: 3 x ? = 18").grid(row=2,column=3)
Button(frame3, text="6", command=correct3, width=20).grid(row=5, column=1)
Button(frame3, text="7", command=incorrect3, width=20).grid(row=5, column=2)
Button(frame3, text="8", command=incorrect3, width=20).grid(row=5, column=3)
Button(frame3, text="9", command=incorrect3, width=20).grid(row=5, column=4)
#Question 4
def correct4():
list = frame4.grid_slaves()
for l in list:
l.destroy()
Label(frame4, text="Correct").grid(row=1,column=5)
flagset()
totalset()
def incorrect4():
list = frame4.grid_slaves()
for l in list:
l.destroy()
Label(frame4, text="Incorrect").grid(row=1,column=5)
flagset()
Label(frame4, text="What is the moniter?").grid(row=2,column=3)
Button(frame4, text="A display that shows what the computer is doing",command=correct4, width=40).grid(row=5,column=1)
Button(frame4, text="A circut board", command=incorrect4, width=20).grid(row=5,column=2)
Button(frame4, text="A Program", command=incorrect4, width=20).grid(row=5,column=3)
Button(frame4, text="A window", command=incorrect4, width=20).grid(row=5,column=4)
#Question 5
def correct5():
list = frame5.grid_slaves()
for l in list:
l.destroy()
Label(frame5, text="Correct").grid(row=1,column=5)
flagset()
totalset()
def incorrect5():
list = frame5.grid_slaves()
for l in list:
l.destroy()
Label(frame5, text="Incorrect").grid(row=1,column=5)
flagset()
Label(frame5, text="What does the 'from ____ import' command do?").grid(row=2,column=3)
Button(frame5, text="Import an image",command=incorrect5, width=15).grid(row=5,column=1)
Button(frame5, text="Import text", command=incorrect5, width=15).grid(row=5,column=2)
Button(frame5, text="Import a module", command=correct5, width=15).grid(row=5,column=3)
Button(frame5, text="Send a module", command=incorrect5, width=15).grid(row=5,column=4)
#Question 6
def correct6():
list = frame6.grid_slaves()
for l in list:
l.destroy()
Label(frame6, text="Correct").grid(row=1,column=5)
totalset()
flagset()
def incorrect6():
list = frame6.grid_slaves()
for l in list:
l.destroy()
Label(frame6, text="Incorrect").grid(row=1,column=5)
flagset()
Label(frame6, text="Which of these is a Boolean Value?").grid(row=2,column=3)
Button(frame6, text="Enter",command=incorrect6, width=15).grid(row=5,column=1)
Button(frame6, text="Esc", command=incorrect6, width=15).grid(row=5,column=2)
Button(frame6, text="True", command=correct6, width=15).grid(row=5,column=3)
Button(frame6, text="False", command=incorrect6, width=15).grid(row=5,column=3)
main()
notebook.pack()
root.mainloop()