← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #141011]: get a string for previous def()

 

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

RaiMan posted a new comment:
If you are interested in being more Python like:

# describe your environment
templates = {} # empty dictonary
templates['1'] = ['1 - Add Access', 'a', 'add access']
templates['2‘] = ['2 - Some Text', 'aa', 'something else']
.... you might have it ;-)

# the following def might be made even more general
def choosetemplate():
 message="Choississez un Template"
 for i in range(1, len(templates)+1):
  message += "\n" + templates[str(i)][0]
 n = input(message)
 while not n in templates:
   n = input(message)
 return n

no need for a def descriptionfield(template):

chosen = choosetemplate()
click() # this I would not do inside the def - it is workflow
type(templates[chosen][1])
wait(1)
click( )
type(templates[chosen][2])

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