Commit 1125f4b9 by Michelle Awh

a

parents a2c158ca d2692ff0
......@@ -13,12 +13,30 @@ def callback_function1():
print('In the callback function 1')
def callback_function2():
sg.popup('In Callback Function 2')
print('In the callback function 2')
sg.popup('In Callback Function 2')
print('In the callback function 2')
'''
layout = [[sg.Text('Wikihow Tool')],
[sg.Text('Search Here'), sg.Input(key = 'Query'), sg.Button('Search')],
[sg.Text('Filters', font = ('Helvetica', 15, 'underline'))],
[sg.Text('ChildSafety'), sg.CBox('On', key = 'child_safe'), sg.Spin([i for i in range(53)], initial_value=0, key = "date_updated"), sg.Text('Max time (months) since last update')],
[sg.Text('Expert Co-authored'), sg.CBox('', key = 'e_verif'), sg.Text('Quality Tested'), sg.CBox('', key = 'q_verif')],
[sg.Text('Minimum % viewers who found it helpful'), sg.Slider(range=(0,100), default_value=50, size=(20,15), orientation='horizontal', font=('Helvetica', 12), key = 'pct_helpful')],
[sg.Spin([i for i in range(100)], initial_value=0, key = "num_voters"), sg.Text('Number of people who voted on helpfulness')],
[sg.Text('Categories'), sg.CBox('House & Garden', key = 'House'), sg.CBox('Computers & Internet', key = 'CP & I'), sg.CBox('Art and Literature', key = 'Arts'), sg.CBox('Social and Organizational Skills', key = 'Social keys')],
[sg.Spin([i for i in range(100)], initial_value=0, key = "num_sources"), sg.Text('Number of sources cited')],
[sg.Spin([i for i in range(100)], initial_value=0, key = "num_views"), sg.Text('Views')],
[sg.Combo(['English', 'Español', 'Português', 'Italiano', 'Français', 'русский язык', 'Deutsch', '简体中文', 'Nederlands', 'Čeština', 'Bahasa Indonesia', '日本語', 'हिंदी', 'ภาษาไทย',' العَرَبِيةُ', 'Tiếng Việt', '한국말', 'Türkçe',' فارسی']), sg.Text('Language of the Article')],
[sg.StatusBar( text=f'| Filters On: {None}', size=(30,1), pad=(0,0), text_color='black', background_color='white', relief=sg.RELIEF_FLAT, justification='left', visible=True, key='status_bar' )]]
'''
def interact(filters = {}):
<<<<<<< HEAD
layout = [[sg.Text('Wikihow Tool')],
[sg.Text('Search Here'), sg.Input(key = 'Query'), sg.Button('Search')],
......@@ -75,4 +93,56 @@ def display_results(filters, results_pg_active):
=======
layout = [[sg.Text('Wikihow Tool')],
[sg.Text('Search Here'), sg.Input(key = 'Query'), sg.Button('Search')],
[sg.Text('Filters', font = ('Helvetica', 15, 'underline'))],
[sg.Text('ChildSafety'), sg.CBox('On', key = 'child_safe'), sg.Spin([i for i in range(53)], initial_value=0, key = "date_updated"), sg.Text('Max time (months) since last update')],
[sg.Text('Expert Co-authored'), sg.CBox('', key = 'e_verif'), sg.Text('Quality Tested'), sg.CBox('', key = 'q_verif')],
[sg.Text('Minimum % viewers who found it helpful'), sg.Slider(range=(0,100), default_value=50, size=(20,15), orientation='horizontal', font=('Helvetica', 12), key = 'pct_helpful')],
[sg.Spin([i for i in range(100)], initial_value=0, key = "num_voters"), sg.Text('Number of people who voted on helpfulness')],
[sg.Text('Categories'), sg.CBox('House & Garden', key = 'House'), sg.CBox('Computers & Internet', key = 'CP & I'), sg.CBox('Art and Literature', key = 'Arts'), sg.CBox('Social and Organizational Skills', key = 'Social keys')],
[sg.Spin([i for i in range(100)], initial_value=0, key = "num_sources"), sg.Text('Number of sources cited')],
[sg.Spin([i for i in range(100)], initial_value=0, key = "num_views"), sg.Text('Views')],
[sg.Combo(['English', 'Español', 'Português', 'Italiano', 'Français', 'русский язык', 'Deutsch', '简体中文', 'Nederlands', 'Čeština', 'Bahasa Indonesia', '日本語', 'हिंदी', 'ภาษาไทย',' العَرَبِيةُ', 'Tiếng Việt', '한국말', 'Türkçe',' فارسی']), sg.Text('Language of the Article')],
[sg.StatusBar( text=f'| Filters On: {None}', size=(30,1), pad=(0,0), text_color='black', background_color='white', relief=sg.RELIEF_FLAT, justification='left', visible=True, key='status_bar' )]]
#layout_x = layout
print('im interacting')
window = sg.Window('WikiHow Search and Filters', layout)
results_pg_active = False
while True:
print(results_pg_active)
event, values = window.read()
if event == sg.WIN_CLOSED:
break
elif not results_pg_active and event == 'Search':
results_pg_active = True
filters = values
wh_query = values['Query']
print(event, values)
display_results(filters, results_pg_active)
results_pg_active = False
window.close()
def display_results(filters, results_pg_active):
print(results_pg_active)
query = filters['Query']
results = SearchResults.SearchResults(query, filters)
print(results)
layout2 = [[sg.Text('Results')],
[sg.Text(str(filters))]]
win2 = sg.Window('Window 2', layout2)
if results_pg_active:
ev2, vals2 = win2.read(timeout=100)
if ev2 == sg.WIN_CLOSED or ev2 == 'Exit':
results_pg_active = False
win2.close()
#code to add window here
>>>>>>> d2692ff014493cfae8c975b6a9b16d55f549c9fb
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment