Commit 9aa509c1 by Michelle Awh

renamed PyGUI as WikiHowHow - user interface cdoe will be in this document

parent ea2e1a08
# hello_psg.py
import sys
import PySimpleGUI as sg
import SearchResults
def callback_function1():
sg.popup('In Callback Function 1')
print('In the callback function 1')
def callback_function2():
sg.popup('In Callback Function 2')
print('In the callback function 2')
Filters = None
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: {Filters}', 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():
window = sg.Window('WikiHow Search and Filters', layout)
while True:
event, values = window.read()
print(event, values)
if event == sg.WIN_CLOSED:
break
elif event == 'Search':
filters = values
#filters["num"]
wh_query = values['Query']
print(filters, wh_query)
window.close()
'''
sg.theme('DarkAmber') # Add a little color to your windows
# All the stuff inside your window. This is the PSG magic code compactor...
layout = [ [sg.Text('Some text on Row 1')],
[sg.Text('Enter something on Row 2'), sg.InputText()],
[sg.OK(), sg.Cancel()]]
# Create the Window
window = sg.Window('Window Title', layout)
# Event Loop to process "events"
while True:
event, values = window.read()
if event in (sg.WIN_CLOSED, 'Cancel'):
break
print('you entered', values[0])
window.close()
'''
\ No newline at end of file
from bs4 import BeautifulSoup
import requests
import re
import urllib.parse
# hello_psg.py
import sys
import unicodedata
import WikiHowHow
import PySimpleGUI as sg
import SearchResults
import PyGUI
def interact():
PyGUI.interact()
\ No newline at end of file
def callback_function1():
sg.popup('In Callback Function 1')
print('In the callback function 1')
def callback_function2():
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 = {}):
window = sg.Window('WikiHow Search and Filters', layout)
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
elif event == 'Search':
filters = values
wh_query = values['Query']
print(event, values)
display_results(filters)
window.close()
def display_results(filters):
query = filters['Query']
results = SearchResults.SearchResults(query, filters)
print(results)
#code to add window here
'''
sg.theme('DarkAmber') # Add a little color to your windows
# All the stuff inside your window. This is the PSG magic code compactor...
layout = [ [sg.Text('Some text on Row 1')],
[sg.Text('Enter something on Row 2'), sg.InputText()],
[sg.OK(), sg.Cancel()]]
# Create the Window
window = sg.Window('Window Title', layout)
# Event Loop to process "events"
while True:
event, values = window.read()
if event in (sg.WIN_CLOSED, 'Cancel'):
break
print('you entered', values[0])
window.close()
'''
\ No newline at end of file
from bs4 import BeautifulSoup
import requests
import re
import urllib.parse
import sys
import unicodedata
import WikiHowHow
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