pyautogui.center,TypeError:“ NoneType”对象不可替换

时间:2018-07-03 20:15:30

标签: typeerror pyautogui

我正在尝试编写程序来处理一些无聊的事情。当我尝试使用generate(expression: array, variables: variable collection) -> collection results <- empty collection for nextVar in variables add generate(expression + nextVar, variables - nextVar) to results if #variables in expression - #operators in expression >= 2 for every possible operator add generate(expression + operator, variables) to results return results 时出现错误。这是代码和错误的示例:

Function ConvertTime(hours, minutes)
     return hours + (minutes/60)
End Function
pyautogui.center()

1 个答案:

答案 0 :(得分:0)

这可能是因为在屏幕上也找不到图像。但是试试这个

sample_image = pyautogui.locateAllOnScreen('sample.png')
center_of_image = pyautogui.center(sample_image)
pyautogui.mouseDown(center[0], center[1])
pyautogui.mouseUp(center[0], center[1])