Timing of canvas presentation in a loop
I have an issue I really have troubles figuring out with timing.
A simplified version of what I try to do is:
- presenting a canvas;
- then wait for a keyboard answer (timeout 800 ms).
So I just have in a loop and inline calling the canvas, then the keyboard, like:
python my_keyboard = keyboard(keylist=['SPACE']) my_keyboard.flush() python
python var.time_present = show_stim(var.trial_shape).show() var.practice_key_pressed_Trial, var.pattern_abs_time_response_Trial = my_keyboard.get_key(timeout=800) python
show_stim is just a little function with the name of the canvas to display.
Anyway so when I do that I log the time of canvas presentation in var.time_present. Issue I have is that when I substract the difference between two var.time_present is not equal to 800 ms (well or to something close depending the refresh rate) and constant.
So I wonder if my canvas are staying for a same amount of time on the display.
I join a code example to this maybe it will be more understanble.