def feedback(correct, window):

    """
    Shows feedback (Correct! or Wrong!) after each test
    """
    feedback_text = None
    color = None

    if correct:
        feedback_text = "Correct!"
        color = "Green"
    else:
        feedback_text = "Wrong"
        color = "Red"

    feedback = TextStim(win=window,
                        text=feedback_text,
                        pos=(0, 0),
                        alignHoriz='center',
                        alignVert='center',
                        height=50,
                        color=color)

    feedback.setAutoDraw(True)

    for frameN in range(60):
        window.flip()

    feedback.setAutoDraw(False)

    window.flip()
def get_user_input(window, position, fontsize=50):

    """
    Allows the user to type and see what they type on the screen

    (This is more annoying than it should be on Psychopy, but it works fine now
    so you shouldn't need to change it)
    """

    input_name = ""
    user_input = TextStim(win=window,
                          text=input_name,
                          pos=position,
                          height=fontsize)

    user_input.setAutoDraw(True)
    window.flip()

    while True:
        char = event.waitKeys()[0]
        if char.isalpha() and len(char) == 1:
            input_name += char
        if char == 'return':
            user_input.setAutoDraw(False)
            window.flip()
            return input_name
        if char == 'comma':
            # psychopy inexplicably doesn't respond to the backspace key,
            # so I use the '<' symbol instead
            input_name = input_name[:-1]

        user_input.text = input_name
        window.flip()