Waiting execution

Asked by alex on 2017-06-24

is there have any script to see my log message like that?

waiting ....(20)
waiting.....(19)
waiting....(18)
waiting...(17)
.
.
.
waiting...(1)

when the sikuli script like this :
while True :
         wait(20)

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
masuo
Solved:
2017-06-24
Last query:
2017-06-24
Last reply:
2017-06-24
Best masuo (masuo-ohara) said : #1

This is sample codes by using thread feature.
If you want to know more about thread feature , learn python.

import thread

def log_waiting(name, *args):
    print "start",name
    cnt = args[0]
    while log_switch == True:
        print "waiting...(%d)" % cnt
        cnt = cnt - 1
        sleep(1)
    print "end",name

duration = 5
thread.start_new_thread(log_waiting,("Log Waiting",duration))
print "start sleep"
log_switch = True
sleep(duration)
log_switch = False
print "end sleep"

alex (alexdniel88) said : #2

Thanks masuo, that solved my question.