-
Notifications
You must be signed in to change notification settings - Fork 0
/
main3.py
549 lines (525 loc) · 23.9 KB
/
main3.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
import webbrowser
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
import csv
from kivymd.uix.datatables import MDDataTable
from kivy.metrics import dp
from kivymd.app import MDApp
from kivy.storage.jsonstore import JsonStore
import json
from kivy.core.window import Window
from kivy.uix.scrollview import ScrollView
from kivymd.uix.card import MDCard
from kivymd.uix.label import MDLabel
from kivymd.uix.button import MDFlatButton
from kivymd.uix.screen import Screen
from kivymd.uix.dialog import MDDialog
from kivymd.uix.button import MDFlatButton
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivymd.theming import ThemableBehavior
from kivymd.uix.list import MDList
from kivy.uix.screenmanager import ScreenManager, Screen
from backend_kivy import FigureCanvasKivy
from kivy.clock import Clock
# from kivy.garden.matplotlib.backend_kivyagg import FigureCanvasKivyAgg
Window.size = (450, 700)
class WelcomeScreen(Screen):
pass
class LoginScreen(Screen):
pass
class SignupScreen(Screen):
pass
class MainScreen(Screen):
pass
class ProfileScreen(Screen):
pass
class ContentNavigationDrawer(BoxLayout):
pass
class DrawerList(ThemableBehavior, MDList):
pass
class QuizScreen(Screen):
pass
class QuizScreen1(Screen):
pass
class QuizScreen2(Screen):
pass
class QuizScreen3(Screen):
pass
class QuizScreen4(Screen):
pass
class QuizScreen5(Screen):
pass
class QuizScreen6(Screen):
pass
class QuizScreen7(Screen):
pass
class QuizScreen8(Screen):
pass
class QuizScreen9(Screen):
pass
class QuizScreen10(Screen):
pass
class ResultScreen(Screen):
pass
class AnalysisScreen(Screen):
pass
class HistoryScreen(Screen):
pass
class RecommendScreen1(Screen):
pass
class RecommendScreen2(Screen):
pass
class MD3Card(MDCard):
pass
sm = ScreenManager()
sm.add_widget(WelcomeScreen(name='welcome'))
sm.add_widget(LoginScreen(name='login'))
sm.add_widget(SignupScreen(name='signup'))
sm.add_widget(MainScreen(name='main'))
sm.add_widget(ProfileScreen(name='profile'))
sm.add_widget(QuizScreen1(name='quiz1'))
sm.add_widget(QuizScreen2(name='quiz2'))
sm.add_widget(QuizScreen3(name='quiz3'))
sm.add_widget(QuizScreen4(name='quiz4'))
sm.add_widget(QuizScreen5(name='quiz5'))
sm.add_widget(QuizScreen6(name='quiz6'))
sm.add_widget(QuizScreen7(name='quiz7'))
sm.add_widget(QuizScreen8(name='quiz8'))
sm.add_widget(QuizScreen9(name='quiz9'))
sm.add_widget(QuizScreen10(name='quiz10'))
sm.add_widget(ResultScreen(name='result'))
sm.add_widget(AnalysisScreen(name='analysis'))
sm.add_widget(HistoryScreen(name='history'))
sm.add_widget(RecommendScreen1(name='recommend1'))
sm.add_widget(RecommendScreen2(name='recommend2'))
class MainApp(MDApp):
def build(self):
self.str1 = Builder.load_file('file2.kv')
return self.str1
def on_start(self):
self.store = JsonStore('user.json')
f = open('user.json','r')
x = json.load(f)
# self.theme_cls.theme_style = "Dark"
self.str1.get_screen('welcome').manager.current = 'welcome'
# self.str1.get_screen('profile').manager.current = 'profile'
def analysis(self):
f = open('user.json','r+')
x = json.load(f)
length = len(x)
self.username = self.str1.get_screen('login').ids.username_text_field.text
self.password_text = self.str1.get_screen('login').ids.password_text_field.text
try:
for i in range(0,length):
if x[f'Userinfo{i}']['name'] == self.username and x[f'Userinfo{i}']['password'] == self.password_text:
df = pd.read_csv(f'./Data/UserData/user{i}.csv',usecols=["Skill","Score"])
print(df["Skill"])
l = len(df["Skill"])
print(l)
sum = 0
skill = []
score = []
for i in range(0,l):
if skill.__contains__(df.iloc[i]["Skill"]):
continue
else:
print(skill)
skill.append(df.iloc[i]["Skill"])
print(skill)
for i in skill:
for j in range(0,l):
if i == df.iloc[j]["Skill"]:
sum += df.iloc[j]["Score"]
score.append(sum)
sum = 0
res = dict(zip(skill, score))
x = max(res.values())
y = min(res.values())
for i in res:
if res[i] == x:
self.str1.get_screen('analysis').ids.strong.text = i
elif res[i] == y:
self.str1.get_screen('analysis').ids.weak.text = i
print(score)
df1 = pd.DataFrame({"Skill":skill,"Score":score})
print(df1)
x = np.array(df1["Skill"])
y = np.array(df1["Score"])
plt.bar(x,y)
# plt.show()
# plt.plot(df.Skill, df.Score)
# plt.show()
if self.str1.get_screen('analysis').ids.analysis.text == "":
self.str1.get_screen('analysis').ids.analysis.add_widget(FigureCanvasKivy(plt.gcf()))
self.str1.get_screen('analysis').ids.analysis.text = "1"
else:
self.str1.get_screen('analysis').ids.analysis.clear_widgets()
self.str1.get_screen('analysis').ids.analysis.add_widget(FigureCanvasKivy(plt.gcf()))
# self.str1.get_screen('analysis').manager.current = 'analysis'
# self.str1.get_screen('analysis').manager.transition.direction = 'left'
except:
pass
# def refresh(self):
# self.str1.get_screen('analysis').ids.analysis.clear_widgets()
# self.str1.get_screen('analysis').ids.analysis.refresh_done()
# # Clock.schedule_once(refresh,1)
def check_login(self):
f = open('user.json','r')
x = json.load(f)
length = len(x)
self.username_text = self.str1.get_screen('login').ids.username_text_field.text
self.password_text = self.str1.get_screen('login').ids.password_text_field.text
for i in range(0,length):
if x[f'Userinfo{i}']['name'] == self.username_text and x[f'Userinfo{i}']['password'] == self.password_text:
self.str1.get_screen('login').manager.current = 'main'
self.str1.get_screen('main').manager.current = 'main'
self.str1.get_screen('main').manager.transition.direction = 'left'
self.username_changer()
break
else:
self.str1.get_screen('login').manager.current = 'login'
print("User Not Found")
pass
self.str1.get_screen('login').ids.main_button.disabled = True
def check_username(self):
f = open('user.json','r')
x = json.load(f)
length = len(x)
user_check = False
self.username = self.str1.get_screen('login').ids.username_text_field.text
self.password_text = self.str1.get_screen('login').ids.password_text_field.text
if self.username == '' or self.password_text == '':
self.dialogpop(True,True)
else:
for i in range(0,length):
if x[f'Userinfo{i}']['name'] == self.username and x[f'Userinfo{i}']['password'] == self.password_text:
self.str1.get_screen('login').ids.main_button.disabled = False
user_check = True
else:
self.str1.get_screen('login').manager.current = 'login'
print("User Not Found")
pass
self.dialogpop(False,user_check)
def dialogpop(self,login,user):
if login == True and user == False:
cancel_btn_username_dialogue = MDFlatButton(text="Retry", on_release=self.close_username_dialogue)
self.dialog = MDDialog(title="Invalid Username", text="Wrong Username Please Try Again !!", size_hint=(0.8, 0.3), buttons=[cancel_btn_username_dialogue])
self.dialog.open()
pass
# elif login == False and user == True:
# cancel = MDFlatButton(text='Cancel',on_press = self.close_username_dialogue)
# self.dialog = MDDialog(title = 'Invalid Username',text = 'Wrong Username Please Try Again !!',size_hint = (0.8,0.3),buttons = [cancel])
# self.dialog.open()
# pass
elif login == True and user == True:
cancel = MDFlatButton(text='Cancel',on_press = self.close_username_dialogue)
self.dialog = MDDialog(title = 'Invalid Credential',text = 'Please Put Correct Credential',size_hint = (0.8,0.3),buttons = [cancel])
self.dialog.open()
pass
else:
print("Wrong")
def close_username_dialogue(self,obj):
self.dialog.dismiss()
def store_username(self):
f = open('user.json','r+')
self.store1 = JsonStore('id.json')
x = json.load(f)
id = self.store1.get('id')["id"]
self.username_text = self.str1.get_screen('signup').ids.username_text_field.text
self.password = self.str1.get_screen('signup').ids.password_text_field.text
self.email = self.str1.get_screen('signup').ids.email_text_field.text
if self.username_text == '' or self.password == '' or self.email == '':
self.dialogpop(True,True)
self.str1.get_screen('signup').manager.current = 'signup'
pass
elif x == {}:
self.store.put('Userinfo0',id=id-1,name=self.username_text, password=self.password, email=self.email)
with open("./Data/UserData/user0.csv",'w+') as f1:
writer1 = csv.writer(f1)
writer1.writerow(["UserID","Name","Skill","Score"])
f1.close()
self.str1.get_screen('signup').manager.current = 'login'
self.str1.get_screen('signup').transition.direction = 'left'
else:
self.store.put(f'Userinfo{id}',id=id ,name=self.username_text,email= self.email, password= self.password)
with open("./Data/UserData/user"+str(id)+".csv",'w+') as f1:
writer1 = csv.writer(f1)
writer1.writerow(["UserID","Name","Skill","Score"])
f1.close()
self.str1.get_screen('signup').manager.current = 'login'
self.str1.get_screen('signup').manager.transition.direction = 'left'
id += 1
self.store1.put('id',id=id)
self.username_changer()
def username_changer(self):
f = open('user.json','r+')
x = json.load(f)
length = len(x)
self.username = self.str1.get_screen('login').ids.username_text_field.text
self.password_text = self.str1.get_screen('login').ids.password_text_field.text
main_list = []
for i in range(0,length):
if x[f'Userinfo{i}']['name'] == self.username and x[f'Userinfo{i}']['password'] == self.password_text:
self.email = x[f'Userinfo{i}']['email']
self.str1.get_screen('profile').ids.name.text = self.username
self.str1.get_screen('profile').ids.email.text = self.email
df = pd.read_csv(f'./Data/UserData/user{i}.csv',usecols=["Skill","Score"])
size = len(df)
for j in range(0,size):
main_list.append([df.iloc[j]["Skill"],df.iloc[j]["Score"]])
# self.str1.get_screen('profile').ids.status.Fi
break
else:
pass
self.data_tables = MDDataTable(
size_hint=(1, 1),
use_pagination=True,
pagination_menu_pos = 'auto',
column_data=[
("Skill", dp(30)),
("Score", dp(30)),
],
row_data = main_list,
elevation = 4,)
if self.str1.get_screen('profile').ids.status.text == "":
self.str1.get_screen('profile').ids.status.add_widget(self.data_tables)
self.str1.get_screen('history').ids.status.text="1"
else:
self.str1.get_screen('profile').ids.status.clear_widgets()
self.str1.get_screen('profile').ids.status.add_widget(self.data_tables)
def show_history(self):
f = open('user.json','r+')
x = json.load(f)
length = len(x)
self.username = self.str1.get_screen('login').ids.username_text_field.text
self.password_text = self.str1.get_screen('login').ids.password_text_field.text
main_list = []
for i in range(0,length):
if x[f'Userinfo{i}']['name'] == self.username and x[f'Userinfo{i}']['password'] == self.password_text:
self.email = x[f'Userinfo{i}']['email']
self.str1.get_screen('profile').ids.name.text = self.username
self.str1.get_screen('profile').ids.email.text = self.email
df = pd.read_csv(f'./Data/UserData/user{i}.csv',usecols=["Skill","Score"])
size = len(df)
for j in range(0,size):
main_list.append([df.iloc[j]["Skill"],df.iloc[j]["Score"]])
# self.str1.get_screen('profile').ids.status.Fi
break
else:
pass
self.data_tables = MDDataTable(
size_hint=(1, 1),
use_pagination=True,
pagination_menu_pos = 'auto',
rows_num = 10,
column_data=[
("Skill", dp(30)),
("Score", dp(30)),
],
row_data = main_list,
elevation = 4,)
print(main_list)
if self.str1.get_screen('history').ids.status.text == "":
self.str1.get_screen('history').ids.status.add_widget(self.data_tables)
self.str1.get_screen('history').ids.status.text = "1"
else:
self.str1.get_screen('history').ids.status.clear_widgets()
self.str1.get_screen('history').ids.status.add_widget(self.data_tables)
def check1(self,x):
print("You Clicked")
print(x)
self.str1.get_screen(x).ids.option1.md_bg_color = (0,0,1,1)
self.str1.get_screen(x).ids.option1.theme_text_color = 'Custom'
self.str1.get_screen(x).ids.option2.md_bg_color = (0,0,1,0)
self.str1.get_screen(x).ids.option2.theme_text_color = 'Primary'
self.str1.get_screen(x).ids.option3.md_bg_color = (0,0,1,0)
self.str1.get_screen(x).ids.option3.theme_text_color = 'Primary'
self.str1.get_screen(x).ids.option4.md_bg_color = (0,0,1,0)
self.str1.get_screen(x).ids.option4.theme_text_color = 'Primary'
def check2(self,x):
print("You Clicked")
print(x)
self.str1.get_screen(x).ids.option2.md_bg_color = (0,0,1,1)
self.str1.get_screen(x).ids.option2.theme_text_color = 'Custom'
self.str1.get_screen(x).ids.option1.md_bg_color = (0,0,1,0)
self.str1.get_screen(x).ids.option1.theme_text_color = 'Primary'
self.str1.get_screen(x).ids.option3.md_bg_color = (0,0,1,0)
self.str1.get_screen(x).ids.option3.theme_text_color = 'Primary'
self.str1.get_screen(x).ids.option4.md_bg_color = (0,0,1,0)
self.str1.get_screen(x).ids.option4.theme_text_color = 'Primary'
def check3(self,x):
print("You Clicked")
print(x)
self.str1.get_screen(x).ids.option3.md_bg_color = (0,0,1,1)
self.str1.get_screen(x).ids.option3.theme_text_color = 'Custom'
self.str1.get_screen(x).ids.option2.md_bg_color = (0,0,1,0)
self.str1.get_screen(x).ids.option2.theme_text_color = 'Primary'
self.str1.get_screen(x).ids.option1.md_bg_color = (0,0,1,0)
self.str1.get_screen(x).ids.option1.theme_text_color = 'Primary'
self.str1.get_screen(x).ids.option4.md_bg_color = (0,0,1,0)
self.str1.get_screen(x).ids.option4.theme_text_color = 'Primary'
def check4(self,x):
print("You Clicked")
print(x)
self.str1.get_screen(x).ids.option4.md_bg_color = (0,0,1,1)
self.str1.get_screen(x).ids.option4.theme_text_color = 'Custom'
self.str1.get_screen(x).ids.option2.md_bg_color = (0,0,1,0)
self.str1.get_screen(x).ids.option2.theme_text_color = 'Primary'
self.str1.get_screen(x).ids.option3.md_bg_color = (0,0,1,0)
self.str1.get_screen(x).ids.option3.theme_text_color = 'Primary'
self.str1.get_screen(x).ids.option1.md_bg_color = (0,0,1,0)
self.str1.get_screen(x).ids.option1.theme_text_color = 'Primary'
def quiz(self,skill):
self.store1 = JsonStore('id.json')
if skill == "Python":
df = pd.read_csv('./Data/Questions/quiz1.csv')
self.store1.put('skill',skill=skill)
elif skill == "Java":
df = pd.read_csv('./Data/Questions/java.csv')
self.store1.put('skill',skill=skill)
elif skill == "C++":
df = pd.read_csv('./Data/Questions/c++.csv')
self.store1.put('skill',skill=skill)
elif skill == "Graphic Design":
df = pd.read_csv('./Data/Questions/graphic.csv')
self.store1.put('skill',skill=skill)
elif skill == "Web Development":
df = pd.read_csv('./Data/Questions/web.csv')
self.store1.put('skill',skill=skill)
elif skill == "Javascript":
df = pd.read_csv('./Data/Questions/javascript.csv')
self.store1.put('skill',skill=skill)
else:
cancel_btn_username_dialogue = MDFlatButton(text="Retry", on_release=self.close_username_dialogue)
self.dialog = MDDialog(title="No Skill", text="There Are No Skill Selected", size_hint=(0.8, 0.3), buttons=[cancel_btn_username_dialogue])
self.dialog.open()
self.str1.get_screen('main').manager.current = 'main'
pass
x = len(df)
for i in range(0,x):
self.str1.get_screen(f'quiz{i+1}').ids.question.text = df.iloc[i]['question']
self.str1.get_screen(f'quiz{i+1}').ids.option1.text = df.iloc[i]['option1']
self.str1.get_screen(f'quiz{i+1}').ids.option2.text = df.iloc[i]['option2']
self.str1.get_screen(f'quiz{i+1}').ids.option3.text = df.iloc[i]['option3']
self.str1.get_screen(f'quiz{i+1}').ids.option4.text = df.iloc[i]['option4']
def next(self,sc):
self.store1 = JsonStore('id.json')
score = self.store1.get('score')["score"]
x = self.str1.get_screen(sc).ids
if self.store1["skill"]["skill"] == "Python":
df = pd.read_csv('./Data/Questions/quiz1.csv')
elif self.store1["skill"]["skill"] == "Java":
df = pd.read_csv('./Data/Questions/java.csv')
elif self.store1["skill"]["skill"] == "C++":
df = pd.read_csv('./Data/Questions/c++.csv')
elif self.store1["skill"]["skill"] == "Graphic Design":
df = pd.read_csv('./Data/Questions/graphic.csv')
elif self.store1["skill"]["skill"] == "Web Development":
df = pd.read_csv('./Data/Questions/web.csv')
elif self.store1["skill"]["skill"] == "Javascript":
df = pd.read_csv('./Data/Questions/javascript.csv')
else:
pass
if x.option1.md_bg_color == [0,0,1,1]:
if x.option1.text == df.iloc[int(sc[-1])-1]['answer']:
score += 2
self.store1.put('score',score=score)
print(score)
else:
pass
elif x.option2.md_bg_color == [0,0,1,1]:
if x.option2.text == df.iloc[int(sc[-1])-1]['answer']:
score += 2
self.store1.put('score',score=score)
print(score)
else:
pass
elif x.option3.md_bg_color == [0,0,1,1]:
if x.option3.text == df.iloc[int(sc[-1])-1]['answer']:
score += 2
self.store1.put('score',score=score)
print(score)
else:
pass
elif x.option4.md_bg_color == [0,0,1,1]:
if x.option4.text == df.iloc[int(sc[-1])-1]['answer']:
score += 2
self.store1.put('score',score=score)
print(score)
else:
pass
else:
print(score)
def restart(self):
print("Hey")
for i in range(1,11):
self.str1.get_screen(f"quiz{i}").ids.option1.md_bg_color = (0,0,1,0)
self.str1.get_screen(f"quiz{i}").ids.option1.theme_text_color = 'Primary'
self.str1.get_screen(f"quiz{i}").ids.option2.md_bg_color = (0,0,1,0)
self.str1.get_screen(f"quiz{i}").ids.option2.theme_text_color = 'Primary'
self.str1.get_screen(f"quiz{i}").ids.option3.md_bg_color = (0,0,1,0)
self.str1.get_screen(f"quiz{i}").ids.option3.theme_text_color = 'Primary'
self.str1.get_screen(f"quiz{i}").ids.option4.md_bg_color = (0,0,1,0)
self.str1.get_screen(f"quiz{i}").ids.option4.theme_text_color = 'Primary'
def store_data(self,skill,score):
f = open('user.json','r')
x = json.load(f)
length = len(x)
self.username_text = self.str1.get_screen('login').ids.username_text_field.text
self.password_text = self.str1.get_screen('login').ids.password_text_field.text
for i in range(0,length):
if x[f'Userinfo{i}']['name'] == self.username_text and x[f'Userinfo{i}']['password'] == self.password_text:
with open('./Data/UserData/user'+str(x[f'Userinfo{i}']["id"])+".csv",'a+') as f1:
writer1 = csv.writer(f1)
writer1.writerow([x[f'Userinfo{i}']["id"],x[f'Userinfo{i}']["name"],skill,score])
f1.close()
break
def result(self):
self.store1 = JsonStore('id.json')
skill = self.store1.get('skill')["skill"]
x = self.store1.get('score')["score"]
self.str1.get_screen('result').ids.result.text = ""+str(x)+"/20"
self.store_data(skill,str(x))
x*=0
self.store1.put('score',score=x)
self.username_changer()
def recommend(self,screen):
print("Hello")
df = pd.read_csv('./Data/recommend.csv')
topics = []
if screen == "recommend1":
x = self.str1.get_screen('analysis').ids.strong.text
elif screen == 'recommend2':
x = self.str1.get_screen('analysis').ids.weak.text
for i in range(0,len(df)):
if x == df.iloc[i]['Skill']:
topics.append(df.iloc[i]['Topic'])
print(topics)
self.str1.get_screen(screen).ids.item1_label.text = topics[-5]
self.str1.get_screen(screen).ids.item2_label.text = topics[-4]
self.str1.get_screen(screen).ids.item3_label.text = topics[-3]
self.str1.get_screen(screen).ids.item4_label.text = topics[-2]
self.str1.get_screen(screen).ids.item5_label.text = topics[-1]
def web(self,screen,item):
if item == "item1_label":
x = self.str1.get_screen(screen).ids.item1_label.text
elif item == "item2_label":
x = self.str1.get_screen(screen).ids.item2_label.text
elif item == "item3_label":
x = self.str1.get_screen(screen).ids.item3_label.text
elif item == "item4_label":
x = self.str1.get_screen(screen).ids.item4_label.text
elif item == "item5_label":
x = self.str1.get_screen(screen).ids.item5_label.text
df = pd.read_csv('./Data/recommend.csv')
for i in range(0,len(df)):
if x == df.iloc[i]['Topic']:
y = df.iloc[i]['Link']
print(y)
webbrowser.open(y)
break
else:
pass
MainApp().run()