Type in answer to a problem presented with an image or audio file

Hi!
We’re doing a exam project, where participants are presented with some math equations either as an image or audio file.
We want to make it possible for the participants to type in the answer using the keyboard (keeping the picture showing) but cannot figure out, how to do that.

We have this loop for presenting the stimuli:
for i in stimuli:
if i [-5]==“a”: #the name of our file has an s if it is audio
sound1 = sound.Sound(i)
sound1.play()
win.flip()
event.waitKeys()
elif i[-5] == “v”: #same but for pictures
img = visual.ImageStim(win, i)
img.draw()
win.flip()
event.waitKeys()

Can someone help?

We’re using coder btw.

Hi @AUhss, take a look at our text input demo - you can download the Builder files and adapt it to your experiment.


https://run.pavlovia.org/demos/textinput/html

Thank you, however I am using Coder, so I’m not sure that will work for me.

The part that gets the text to present on screen uses a code component, so you can take the coded parts and apply them to your task. In short, the code gets the keyboard input, and adds it to a text component which is being drawn on screen.

Okay thank you so much!