问题描述
我正在写一个程序,我想让用户在pyautogui中以提示功能的形式输入反馈。有什么办法可以记录在此处输入的文本;最好在文本文件中?
解决方法
他们的 docs 说 pyautogui.prompt
返回文本输入或 None
如果用户点击取消。可以像这样将文本输入写入文件:
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)