The source code becomes longer when the click function and the sleep function are arranged side by side. https://qiita.com/JINPLAYSGUITAR/items/0fdadac1ebb7e9289f2d
Prepare your own function
--Click the specified image and wait for the specified time --Arguments are images and numbers (seconds) --Judge the presence or absence of an image at the fastest speed --Loop if no image is found --After looping 5 times, return an error and exit
pricone.py
#Common function
def waitClick(cap, time):
index = 0
while 1:
if exists(cap):
click(cap)
sleep(time)
break
index = index + 1
if index == 5:
print("error")
click(cap) #Raise an error
exit()
#How to call
waitClick("1571732207730.png ", 5)
https://sikulix-2014.readthedocs.io/en/latest/region.html#Region.click
end
Recommended Posts