我写
pyautogui.typewrite(to_type)
为自动键盘和鼠标编写脚本。 to_type = -0.2并且它仅写入0.2。我有英文键盘。它写的不带负号
pyautogui.typewrite(-0.2)
也是。您知道问题出在哪里吗?谢谢
代码
import pyautogui
import time
for i in range(1, 3):
pyautogui.click(509, 679) # move to field
pyautogui.typewrite(['backspace', 'backspace', 'backspace', 'backspace', 'backspace', 'backspace', 'backspace', 'backspace'])
value = -0.5 + (i - 1) * 0.3 # computation numbers that will be write in field
to_type = "%f" % value
print(to_type)
#pyautogui.press('-')
pyautogui.typewrite(to_type) # writing previous number
time.sleep(2)
pyautogui.typewrite(['enter']) # enter the input of number
pyautogui.PAUSE = 0.5
pyautogui.click(169, 681) # plot
pyautogui.PAUSE = 0.5
pyautogui.click(330, 685) # save
pyautogui.click(448, 174) # file name
to_type = "data{}".format(i)
print(to_type)
pyautogui.typewrite(to_type) # writing name of file
pyautogui.click(978, 664) # save file
pyautogui.PAUSE = 0.5