I am trying to change the index of a for loop depending if a user wants to go to the previous image (index = index - 1) and if he wants to go the next image (index = index + 1) however, the index doesnt change in the outerloop (outside the if statements).
flag = False
while flag == False:
for i in range(len(all_image)):
image = all_image[i]
print(i)
userchoice = easygui.buttonbox(msg, image = image, choices=choices)
if userchoice == 'Next':
i = i+1
elif userchoice == 'Previous':
i = i-1
elif userchoice == 'cancel':
print('test')
flag = True
break
Thanks in advance.
for-loop. It will always get next value fromrange().forloop - you need awhileloop