psychopy.visual.rect.Rect().contains only works if screen is continuosly flipped

Hello, Everyone.

I an new to the psychopy community, I was previously writing tasks in Psychtoolbox and now I am transitioning to Psychopy to run my visual experiments.

I wrote a simple gaze contingent task and I used the ‘‘psychopy.visual.rect.Rect().contains()’’ method to quantify the duration of a saccade to a specific target.

Everything seems to work just fine, however, I found out that the ‘‘obj.contains()’’ method does not work if I don’t continually flip the screen. This is weird, because one would expect that the method works regardless of screen flipping.

Specifically,

if I comment the line:

# flip_time = draw_Marm(debug_mode = debug_mode)

which is just a simple function that flips the screen in this loop:

            while WaitMarmClock.getTime() < Stim_Duration:
                # Check eye position
                screen_x, screen_y = Get_Eye(dummy_mode)
                if screen_x is not None and screen_y is not None:
                    flip_time = draw_Marm(debug_mode = debug_mode)
                    if FixMarm.contains(screen_x, screen_y, units = 'deg'): 
                        if MarmGazeWinClock.getTime() > Marm_Fixation:
                            
                            Hit = 1
                            
                            # Timestamp
                            Send_Timestamp(code = 4, 
                                flip_time = flip_time, 
                                trial = trial_count) # Successful trial - HIT
                            # Reward
                            Send_Reward(Num_of_Rewards) # Give one reward
                            core.wait(DurAfterReward) 
                            break
                    else:
                        MarmGazeWinClock.reset() # Reset clock

Then, the condition FixMarm.contains(screen_x, screen_y, units = ‘deg’) is never reached, the code crashes and I reach the error: Program exiting with code 3489660927.

I found this by mistake, because I flip the window every time for timing purposes. But I wanted to share this in case someone finds it useful.

Saccade_task.py (17.7 KB)