← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #161632]: True or False when image is visible

 

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

Calle Rundgren posted a new comment:
Yes we are talking about a function.

I just tested both of your above solutions and both are working. From
what I have been reading in other examples exists() is to prefer above
find()?

I have no answer for why I am not using exists directly, Maybe I was to
locked up in mind that I got to use an if-statement. Or that there are
supposed to be some other tasks before the function and therefore I
wanted to use if exists().

There are two possible intentions.
1. The usage is to check if a certain image is visible at a certain moment, and then return either True or False. In order to be able to add more code to the function which perform different tasks depending on if True or False is returned. Example on which code who could be added:

while True:
    App.open(r"c:\example.exe")
    break

Or is it better to use while directly like this:

while exists(image):
    App.open(r"c:\example.exe")

2. There are many functions after eachother so another intention would
be to know which function who returned True/False.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.