如何单击定义区域外的图像?

How do I click on an image outside the defined region?

能否帮我解决以下问题:

我用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