MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / QueryHowDoI

Function QueryHowDoI

DemoPrograms/Demo_HowDoI.py:82–96  ·  view source on GitHub ↗

Kicks off a subprocess to send the 'Query' to HowDoI Prints the result, which in this program will route to a gooeyGUI window :param Query: text english question to ask the HowDoI web engine :return: nothing

(Query, num_answers, full_text)

Source from the content-addressed store, hash-verified

80
81
82def QueryHowDoI(Query, num_answers, full_text):
83 '''
84 Kicks off a subprocess to send the 'Query' to HowDoI
85 Prints the result, which in this program will route to a gooeyGUI window
86 :param Query: text english question to ask the HowDoI web engine
87 :return: nothing
88 '''
89 full_text_option = ' -a' if full_text else ''
90 t = subprocess.Popen(HOW_DO_I_COMMAND + ' \"' + Query + '\" -n ' +
91 str(num_answers)+full_text_option, stdout=subprocess.PIPE)
92 (output, err) = t.communicate()
93 print('{:^88}'.format(Query.rstrip()))
94 print('_'*60)
95 print(output.decode("utf-8"))
96 exit_code = t.wait()
97
98
99if __name__ == '__main__':

Callers 1

HowDoIFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected