← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #655511]: Waiting to do 1 of 2 actions

 

Question #655511 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/655511

    Status: Open => Answered

masuo proposed the following answer:
If either the green image or the magenta image will appear sooner or
later, there is a way to wait until it appears.

while True:
    player1 = exists(greenimage,0)
    player2 = exists(magentaimage,0)

    if not player1 and not player2:
        sleep(0.5)
        continue
    else:
        break
if player1:
    print "PLAYER 1 WINS"
else:
    print "PLAYER 2 WINS"

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.