← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #271443]: How can I input a number and accept it as an integer in sikuli?

 

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

masuo proposed the following answer:
If you want to convert a string to an integer , use the function (for example, isdecimal()). 
--------------------
errmsg = ""
while True:
    msg = "Input a number\n" + errmsg
    ans = input(msg)
    if ans == None:
        cancel = True       
        break
    if ans.isdecimal():
        x = int(ans)
        cancel = False
        break
    else:
        errmsg = "'" + ans +"'" + " is not a number"

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