谁能帮我解决以下问题:
我已经用 Sikuli 定义了一个区域。
但现在我想单击超出我定义区域的每个按钮。
有谁知道这是怎么做到的吗?
ImageX2 = ("imageX2.png")
regionIn = find(ImageX2).below()
regionIn.highlight(5)
最佳答案
您可以使用 Region
方法 contains
来实现此目的。
因此,如果您有一个定义的区域:
region = Region(x,y,w,h)
屏幕上有多个按钮:
buttonImageName = "image.png"
buttons = findAll(button)
迭代您的发现并仅选择您所在区域之外的结果
for button in buttons:
if region.contains(button):
continue # that will skip the buttons inside your region
else:
button.click() # that will click on the buttons outside your region
关于python - 如何单击定义区域之外的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31988346/