Receiving None screen after keyboard input from user

Hello,

I’m experiencing an issue that I cannot solve.

Problem:

  1. I have several trials in an experiment – in a middle trial, I want to give subjects a small quiz, which is composed of the 3 questions, one after the other:
    image

  2. Each question is written in an Excel file and displayed in a Text component:

Text component for the last question:
image

  1. Each question has “a”, ”b”, ”c” as possible answers – hence I added a keyboard component after the text component that ends the routine:

Problem:

After typing the answer for the last question, the following screen appears to which there is no exiting, apart from pressing the ESCAPE key:

image

I had a code inserted after the last question to trigger the exit from the trials sequence, after removing it, still no change.

Code:

if (currentLoop.thisRepN == 1):
    trialsQuiz.finished = True

I also searched for answers on this, but I cannot find anything related other than this page:

I thought that this was due to a key press which was faster than 1 second, but it is not the case.

I’ve tried multiple ways around it, I don’t know how to solve it.

Does anyone have any idea?

Thanks.

There are two ways to end your loop after one iteration.

  1. Use the code you are trying but with == 0 instead of == 1 (Python counts from 0 not 1).

  2. Delete the additional blank rows in your spreadsheet. When you reattach. The spreadsheet to the loop how many conditions does it claim to have.

You should be able to exit your current version by pressing a, or c three times to move through the second iteration of the loop.

Hi @wakecarter,

Thanks for the fast answer - I verified the Excel file multiple times, it had 36 conditions (must have been some extra blank rows that I could not delete).

I created another Excel file and it worked.
I left the code with reps==1 because I want to have one repetition of the trial.

Follow up question (independent of initial one and not sure if should ask in the same post):
How to introduce a component where the subjects needs to input text (as a response) that will generate the next window after the user presses “Enter”.
EG:
Text component asking: “Type a few words on something”
Textbox component that is editable: “Something something” (typed by user).
After pressing Enter in the Textbox component, the new routine is activated from the trial.

Should I put a code component?

Thanks!

You can have an editable text box to capture the participant’s input and end the trial on ‘enter’ if you have a keyboard component monitoring for 'return' (set to end the routine) above the editable text component.

Thank you, @wakecarter, this worked!

1 Like