← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #686822]: creating a timer in sikuli, need update from old code.

 

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

RaiMan proposed the following answer:
exec need a string, that represents an executable statement/expression.

It looks like you want to execute something like this in your function:

Settings.timerX = time.time()+nnnn.nnn and
Settings.timerX - time.time()

where X is the value given by parameter name

So do it this way:

    if elapse >0:
        exec("Settings.timer%d = time.time() + %d"%(name. elapse))
    else:
        rest = eval("Settings.timer%d - time.time()"%(name))

but be aware:
Settings.timer1
Settings.timer2
Settings.timer3

must be set before first use like
Settings.timer =time.time()

which in turn is never used

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