reg = Region(20,30,40,50)
reg2 = Region(60,70,80,90)
reg.moveTo(reg)
当我运行这个程序时,我得到了以下错误
TypeError: moveTo(): 1st arg can't be coerced to org.sikuli.script.Location
对 moveTo() 感到困惑,有人可以帮我吗?
reg = Region(20,30,40,50)
reg2 = Region(60,70,80,90)
reg.moveTo(reg)
当我运行这个程序时,我得到了以下错误
TypeError: moveTo(): 1st arg can't be coerced to org.sikuli.script.Location
对 moveTo() 感到困惑,有人可以帮我吗?
尝试
reg.moveTo(reg.getTopLeft())
您的代码不起作用,因为您将 Region 对象而不是 Location 对象传递给 moveTo()。Region 有 2 个额外的宽度和高度值。
尼可洛的回答是正确的。工作脚本示例:
reg = Region(20,30,40,50)
loc = Location(10,10)
reg.moveTo(loc)
“moveTo”文档:http ://doc.sikuli.org/region.html