collect mouse lifts - 'NoneType' object is not iterable
The task: Participants shall press a mouse button to get into a starting position. They shall keep the button pressed and keep the mouse at a certain position (finally i want to do that on a touchscreen).
Then a traffic light appears as a starting counter like 5,4,3,2,1,go!
At the moment it does not go on to 4. Why is the for loop not working?
Image = canvas() Image['startRect'] = Rect(x=0, y=242, w=159, h=159, color='blue', penwidth=10) def TRIALhalf1(): #1st part of a trial shuffle (delay) start = [995,995,995,995,500] #delay instead of 500 my_mouse = Mouse(visible=True) my_mouse.flush() Image.show() while True: #press Mouse and keep it pressed button, (x, y), time = my_mouse.get_click() if (x, y) in Image['startRect']: break for i in range(5): t0 = red[i].show() #timer goes on #red is a list of canvas #if Mouse is lifted start again my_mouse = Mouse(visible=True) #is this line necesary? button, (x, y), time_key_up = my_mouse.get_click_release(timeout=500) #start[i] #THIS IS THE PROBLEMATIC LINE if button != None: i=0 TRIALhalf1() break
TypeError: 'NoneType' object is not iterable
What am i doing wrong? Any ideas?