| Reference | Downloads | Github

Trouble collecting responses and flippping screen during timer

URL of experiment:

Description of the problem: Hello, I am trying to collect space bar presses during a 3 second interval. I am trying to update the screen to show a progress bar of presses. I had this working locally, but am having trouble online because the program does not like win.flip(). Right now, this is located in the routine ‘start_calib’. I have a keyboard component ‘calib_work_space’ that is set for 3 seconds and is looking for space bar presses. I then have a custom code component ‘go_calib’ and in the Begin Routine, I have the code below. Currently, the screen is not updating and I’m not sure if button presses are being collected either. Any suggestions would be wonderful. Thank you!

while timer.getTime() < 3:
    current_time = timer.getTime()
    if calib_work_space.keys == 'space':
        calibration_total_presses = calibration_total_presses + 1

        if current_time > calibration_update_duration:
            slide_number = slide_number + 1
            show_slide = visual.ImageStim(win=win,
                            image='calibration/Slide' + str(slide_number) + '.jpeg',
                            size = 1.0)
            calibration_update_duration = calibration_update_duration + 0.25

Hi all. Re-pinging this because I have not had any luck recently.

Hi Amy,

The bad luck might be due to the category you posted your question in (online). Try the “coding” category to be sure it’s picked up by the right people

Best, Thomas

Thanks Thomas!

1 Like