Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Keyboard: is it possible to keep it active until a delay?

Hello,

I an trying to do something like this:

  • presenting a canvas;
  • collecting an answer with the keyboard for a particular duration while the canvas is presented.

The issue I have is that by using get_key, if a response is collected then the canvas disappear and it moves to the next trial.

For now I did something like this but I am not sure if there is not something simpler to do:

for i, valeur in enumerate(fam_trial_canvas):
    var.abs_present_stim_trial = valeur.show()
    var.practice_key_pressed_Trial, var.pattern_abs_time_response_Trial = my_keyboard.get_key(timeout = fam_trial_duration[i])
    if var.practice_key_pressed_Trial is not None:
        var.time_resp_trial = var.pattern_abs_time_response_Trial - var.abs_present_stim_trial
        while clock.time() - var.abs_present_stim_trial < fam_trial_duration[i]:
            valeur.show()
    else:
        var.time_resp_trial = 'NA'

Thanks for any help!

Sylvain

Comments

Sign In or Register to comment.