Reputation: 171
I'm writing a program, and I want to make users type feedback in the form of a prompt function in pyautogui. Is there any way I can record the text entered here; preferably in a text file?
Upvotes: 1
Views: 961
Reputation: 1
More easily you can just save the calling of prompt function to a variable,like:
import pyautogui
text = pyautogui.prompt(text='Do you like apples?', title='Question', default='YES')
#now you will have the text entered in the prompt saved in 'text' variable
print(text)
Upvotes: 0
Reputation: 1090
Their docs say that pyautogui.prompt
returns the text input or None
if users hit cancel. Writing the text input to a file can be done like this:
import pyautogui as py
text = py.prompt(text='Do you like apples?', title='Question', default='YES')
with open('file.txt', 'w') as file:
file.writelines(text)
Upvotes: 1