Trouble using onChange in a for loop
Hello,
I am using Sikulix-IDE-2.0.4
My screen size is 1920*1080
I am trying to run a for loop that click on a region, wait until the screen changes, then click on a region, and so on :
I have tried to use onChange to check that the screen changes, but havent figured out how to do it properly.
I have tried 2 approaches :
1) onChange outside for loop :
time_
time_
Settings.
def map_change_
wait(1)
def change_map(regions, custom_
# regions = list of the regions where to click
for r in regions:
# Wait until we change of map and it loads
It seems that once the event has once be triggered in the first iteration of the loop,
it is always considered as changed, so it doesn't wait to change map.
Is there a way to reset the event in the handler ?
2) onChange inside the for loop
time_
time_
Settings.
def map_change_
wait(1)
def change_map(regions, custom_
# regions = list of the regions where to click
for r in regions:
# Wait until we change of map and it loads
Here it seems to create a new event each time, so at the iteration N of the loop, the handler is called N times, which is dirty and makes N times wait(1). I know i can put the wait(1) outside of the handler, but anyway I don't want the handler to be called N times, and I don't want to fill the memory with events.
Is there a way to remove the events once consumed by the handler ? I tried with region.getEvents() but it isn't working.
Best Regards
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- RaiMan
- Solved:
- Last query:
- Last reply: