sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #20813
Re: [Question #235378]: How to use Wait() or Click() with multi screens?
Question #235378 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/235378
Parn Yin posted a new comment:
Reply to Comment #5:
After testing, it seems that it can't work well.
The loop "if s.exists(someImage, 0):" is executed only once.
RaiMan, Do you know the reason?
After lots of inverstigation, I changed the line
screens = (Screen(i) for i in range(Screen.getNumberScreens()))
to
screens = []
for i in range(0, Screen.getNumberScreens()):
screens.append(Screen(i))
Then it works.
I don't know why...
Now my function is like below, seems work.
Coud you please give me some advices?
def wait_multi_screens(screenshot, wait_time):
if Screen.getNumberScreens() == 1:
wait(screenshot, wait_time)
else:
screens = []
for i in range(0, Screen.getNumberScreens()):
screens.append(Screen(i))
start_time = time.time()
found = False
while (time.time() - start_time < wait_time):
for s in screens:
if s.exists(screenshot, 0):
found = True
break
if found:
break
wait(1)
if found:
return True
else:
popup("[ERROR] Can't find the image on all the monitors.")
raise
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.