Question #300594 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/300594
RaiMan proposed the following answer:
and the next NameError will be with
return true
must be
return True
... and then you will get a problem with acc, since it is defined inside def
MainLoop() and hence local.
in TryCreation acc will always show up as None
def TryCreation(acc):
try:
CreateLoop();
except Exception:
return false;
popup("True: " + acc);
return true;
def MainLoop():
acc = 0
while True:
if TryCreation(acc):
acc+=1;
if !TryCreation(acc):
#closeWindows()
acc-=2;
popup("Initialized...")
MainLoop()
the other option would be to use global:
def TryCreation():
global acc
try:
CreateLoop();
except Exception:
return false;
popup("True: " + acc);
return true;
def MainLoop():
global acc
while True:
if TryCreation():
acc+=1;
if !TryCreation():
#closeWindows()
acc-=2;
popup("Initialized...")
acc = 0 # makes it a global variable
MainLoop()
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.
_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help : https://help.launchpad.net/ListHelp