← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #162885]: use parameters

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
OK, you already reduced this to a function (no need to wrap this into a
class).

--- put this function definition somewhere, so it is processed before
used the first time (might be imported ;-)

def clickElement(img): #different images I want to have in my function
    if exists(img): click(getLastMatch()); return(getLastMatch())
    else: return None

--- usage simple:
clickElement("some-image.png")

--- usage complex:
img = "some-image.png"
m = clickElement(img)
if not m: print img, "not found"; exit()

--- I am having a nice day :-))

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