简体   繁体   中英

error in moveTo() of sikuli

reg = Region(20,30,40,50)
reg2 = Region(60,70,80,90)
reg.moveTo(reg)

When I run this program I got the following error

TypeError: moveTo(): 1st arg can't be coerced to org.sikuli.script.Location

Confused with moveTo(), Could anyone help me out??

Try

reg.moveTo(reg.getTopLeft())

Your code does not work because you are passing a Region object to moveTo() instead of a Location object. Region has 2 additional values for width and height.

Niccolo's answer is correct. Working script example:

reg = Region(20,30,40,50)
loc = Location(10,10)
reg.moveTo(loc)

"moveTo" documentation: http://doc.sikuli.org/region.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM