[open] rerunning sequences
This is going out of my comprehension, but I have this code:
mySequence -- mySketchpad with many RECTS and TEXTS -- myInlineScript
inside myInlineScript the usual code that check mouse position, if it's inside a target I repeat the sequence, if I click more then five times it goes out:
while True:
counter +=1
button, pos, timestamp = my_mouse.get_click()
cursor_x, cursor_y = pos
# Determine x and y error
dx = cursor_x - xc - self.get('xRed')
dy = cursor_y - yc - self.get('yRed')
# Break the loop if there is a hit (use Pythagoras for click error)
clickErr = sqrt(dx**2 + dy**2)
if clickErr <= maxClickErr:
exp.set('showRect','yes')
print "rpeating mySequence.."
exp.items['mySequence'].prepare()
exp.items['mySequence'].run()
print "coming back from my recalled sequence"
if counter>5 :
break
so what I found is that if I click N times inside my target the code correctly calls N times the mySequence, but they are kind of nested, I mean that at the 5th click I am not breaked out from the "main while", but from a "inner while" inside the nested mySequence calls.
What instead I thought is that the prepare/run worked like a "goto". I need to prepare/run because initially some items into the sketchpad are hidden, but visible when a proper variable is set
thanks