← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #156275]: Popup with number is not work!

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
none of these are real Python ;-)

pass is only needed, to have something correctly indented after
if/elif/else/for/while/with, if no other statement would be there
otherwise. But any way, it never does any harm ;-)

a counting loop:

for count in range(10):
   popup(str(count))

see more on loops: faq 1437

count is an integer and popup() wants a string, so it has to be
converted e.g. with str(count)

another more comfortable option to embed formatted numbers and other
objects into a string is with the % operator:

popup( "count is now: %d (and still counting)"%(count) )

see the % operator: http://docs.python.org/library/stdtypes.html#string-
formatting-operations

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