示例#1
0
def run(context):
    win = context['window']
    pressSpaceStim = visual.TextStim(win,
                                     pressSpace,
                                     height=0.06,
                                     pos=[0, -0.8],
                                     wrapWidth=1.7)
    pages = [
        [
            pressSpaceStim,
            visual.TextStim(win,
                            transitionText,
                            pos=[0, 0],
                            height=0.07,
                            wrapWidth=1.7)
        ],
        [
            pressSpaceStim,
            visual.TextStim(win, page1, pos=[0, 0], height=0.07, wrapWidth=1.7)
        ],
    ]
    for page in pages:
        for stim in page:
            stim.draw()
        win.flip()
        proceedOrQuit(win)

    return context
示例#2
0
def run(context):
    win = context['window']

    controlStim1 = visual.TextStim(win,
                                   controlText1,
                                   pos=[0, 0.5],
                                   height=0.06,
                                   wrapWidth=1.5)
    controlStim2 = visual.TextStim(win,
                                   controlText2,
                                   pos=[0, 0.2],
                                   height=0.06,
                                   wrapWidth=1.5)
    controlStim3 = visual.TextStim(win,
                                   controlText3,
                                   pos=[0, -0.1],
                                   height=0.06,
                                   wrapWidth=1.5)
    spaceTextStim = visual.TextStim(win,
                                    spaceText,
                                    pos=[0, -0.8],
                                    height=0.06,
                                    wrapWidth=1.5)

    controlStim1.draw()
    controlStim2.draw()
    controlStim3.draw()
    spaceTextStim.draw()
    win.flip()
    proceedOrQuit(win)

    return context
示例#3
0
def run(context):
    win = context['window']

    textStim = visual.TextStim(win, introText, pos=[0, 0.3], height=0.06, wrapWidth=1.5)

    textStim.draw()
    win.flip()
    proceedOrQuit(win)

    return context
def run(context):
    win = context['window']
    trialNum = context['trialNum']

    results = context['attentionResults' + str(trialNum)]
    actualChanges = results['actualChanges']
    target = results['target']
    successes = results['successes']
    mistakes = results['mistakes']

    changeOptions = ['A', 'B', 'C', 'D']
    whichImage = context['changeQuizResults']['whichImage']
    yesNo = context['changeQuizResults']['yesNo']
    howManyTimes = context['changeQuizResults']['howManyTimes']

    if actualChanges > 0:
        side1 = results['side1']
        side2 = results['side2']
        feedbackImageA = visual.ImageStim(win,image=side1,mask=None,units='norm',pos=[-0.3,-0.72],size=[0.45,0.6])
        feedbackImageB = visual.ImageStim(win,image=side2,mask=None,units='norm',pos=[0.3,-0.72],size=[0.45,0.6])
        if actualChanges>1:
            feedbackChange = visual.TextStim(win,'Your performance on: ' + __trialHumanReadable(trialNum) +
                '\n\nVowel task:\n     Correct responses: ' + str(int(successes)) +
                '\n     Incorrect responses: ' + str(int(mistakes)) + '\n\nImage change task:\n     Image ' +
                changeOptions[target] + ' changed ' + str(actualChanges) +
                ' times (see below).\n\n***Press the SPACE key to proceed when ready***',
                pos=[0,0.5],height=0.06)
        else:
            feedbackChange = visual.TextStim(win,'Your performance on: ' + __trialHumanReadable(trialNum) +
                '\n\nVowel task:\n     Correct responses: ' + str(int(successes)) + '\n     Incorrect responses: ' +
                str(int(mistakes)) + '\n\nImage change task:\n     Image ' + changeOptions[target] + ' changed ' + 
                str(actualChanges) +
                ' time (see below).\n\n***Press the SPACE key to proceed when ready***',
                pos=[0,0.5],height=0.06)
        feedbackChange.draw()
        feedbackImageA.draw()
        feedbackImageB.draw()
    else:
        feedbackNoChange = visual.TextStim(win,'Your performance on: ' + __trialHumanReadable(trialNum) +
                '\n\nVowel task:\n     Correct responses: ' + str(int(successes)) + 
                '\n     Incorrect responses: ' + str(int(mistakes)) + '\n\nImage change task:\n     ' +
                'No images changed during this trial\n\n***Press the SPACE key to proceed when ready***',
            pos=[0,0.5],height=0.06)
        feedbackNoChange.draw()
        feedbackImageA = visual.ImageStim(win,image='AM_3.jpg',mask=None,units='norm',pos=[-0.3,-0.72],size=[0.45,0.6])
        feedbackImageB = visual.ImageStim(win,image='AM_3.jpg',mask=None,units='norm',pos=[0.3,-0.72],size=[0.45,0.6])
        feedbackDebug = visual.TextStim(win, '(No target image on the practice trial)', pos=[0,-0.7],height=0.05)
    
    win.flip()
    proceedOrQuit(win)

    if context['collectData']:
        __setData(context, results)

    return context
def run(context):
    win = context['window']
    imageList = context['imageList']
    markerList = context['markerList']

    textBoxes = gameTextBoxes(win)

    for page in pages:
        __drawPage(win, page, imageList, markerList, textBoxes)
        proceedOrQuit(win)
    return context
def screen1(win):
    summary = visual.TextStim(win,
                              summaryText,
                              pos=[0, 0],
                              height=0.07,
                              wrapWidth=1.7)
    layout = visual.ImageStim(win,
                              image='layout.bmp',
                              mask=None,
                              units='norm',
                              pos=[0, -0.1],
                              size=[0.88, 1.0])

    summary.draw()
    layout.draw()
    pressSpaceStim.draw()
    win.flip()
    proceedOrQuit(win)
示例#7
0
def run(context):

    win = context['window']

    transition1 = visual.TextStim(win,
                                  transitionControlQuiz,
                                  pos=[0, 0.2],
                                  height=0.07,
                                  wrapWidth=1.5)
    pressSpace = visual.TextStim(win,
                                 pressSpaceKey,
                                 pos=[0, -0.8],
                                 height=0.06,
                                 wrapWidth=1.5)

    transition1.draw()
    pressSpace.draw()
    win.flip()
    proceedOrQuit(win)

    context['trialNum'] = 0
    controlImages = context['controlImages']
    for index, image in enumerate(controlImages):
        context['imageList'][index].setImage(image)

    new_context = go(subModules, context)

    transition2 = visual.TextStim(win,
                                  transitionExperimentQuiz,
                                  pos=[0, 0.2],
                                  height=0.07,
                                  wrapWidth=1.5)

    transition2.draw()
    pressSpace.draw()
    win.flip()
    proceedOrQuit(win)

    new_context['trialNum'] = 1
    trialImages = context['trialImages']
    for index, image in enumerate(trialImages):
        context['imageList'][index].setImage(image)

    return go(subModules, new_context)
示例#8
0
def run(context):
    win = context['window']

    screen5 = visual.TextStim(win, screen5Text, pos=[0, 0.3], height=0.07, wrapWidth=1.5)
    pressSpaceStim = visual.TextStim(win, practiceText2, height=0.06, pos=[0, -0.7], wrapWidth=1.7)

    screen5.draw()
    pressSpaceStim.draw()
    win.flip()
    proceedOrQuit(win)

    textStim1 = visual.TextStim(win, practiceText1, pos=[0, 0], height=0.07, wrapWidth=1.5)
    textStim2 = visual.TextStim(win, practiceText2, pos=[0, -0.7], height=0.06, wrapWidth=1.7)

    textStim1.draw()
    textStim2.draw()
    win.flip()
    proceedOrQuit(win)

    return context
示例#9
0
def run(context):
    win = context['window']

    thankYouStim = visual.TextStim(win,
                                   thankYou,
                                   pos=[0, 0.1],
                                   height=0.10,
                                   wrapWidth=1.5)
    spaceBarStim = visual.TextStim(win,
                                   spaceBar,
                                   pos=[0, -0.6],
                                   height=0.06,
                                   wrapWidth=1.5)

    thankYouStim.draw()
    spaceBarStim.draw()
    win.flip()
    proceedOrQuit(win)

    return context
示例#10
0
def __welcomeAndSummary(win):
    pressSpaceStim = visual.TextStim(win,
                                     pressSpace,
                                     height=0.06,
                                     pos=[0, -0.8],
                                     wrapWidth=1.7)
    welcome = visual.TextStim(win, welcomeText, height=0.10)
    welcome.draw()
    pressSpaceStim.draw()
    win.flip()
    proceedOrQuit(win)

    introStim = visual.TextStim(win, intro, wrapWidth=1.7, height=0.07)
    introStim.draw()
    pressSpaceStim.draw()
    win.flip()
    proceedOrQuit(win)

    pressSpaceStim_task1 = visual.TextStim(win,
                                           pressSpace_task1,
                                           height=0.06,
                                           pos=[0, -0.8],
                                           wrapWidth=1.7)

    beginStim = visual.TextStim(win,
                                beginWithGame1,
                                wrapWidth=1.7,
                                height=0.10,
                                bold=True)
    beginStim.draw()
    pressSpaceStim_task1.draw()
    win.flip()
    proceedOrQuit(win)

    summary = visual.TextStim(win,
                              summaryText,
                              pos=[0, 0],
                              height=0.07,
                              wrapWidth=1.7)
    layout = visual.ImageStim(win,
                              image='layout.bmp',
                              mask=None,
                              units='norm',
                              pos=[0, -0.1],
                              size=[0.88, 1.0])

    summary.draw()
    layout.draw()
    pressSpaceStim.draw()
    win.flip()
    proceedOrQuit(win)
def run(context):
    win = context['window']
    imageList = context['imageList']
    markerList = context['markerList']

    textBoxes = gameTextBoxes(win)
    pages = [(False, (None, None), [], [
        visual.TextStim(win,
                        page1Section1,
                        pos=[0, 0.3],
                        height=0.07,
                        wrapWidth=1.5),
        visual.TextStim(win,
                        proceedInstructions,
                        pos=[0, -0.3],
                        height=0.06,
                        wrapWidth=1.5)
    ]),
             (True, (4, None),
              ["$ 5.00", "$ 5.00", "$ 5.00", "$ 5.00", "$ 5.00"], [
                  visual.TextStim(win,
                                  page2Section1,
                                  pos=[0, 0.4],
                                  height=0.06,
                                  wrapWidth=1.5),
                  visual.TextStim(win,
                                  page2Section2,
                                  pos=[0, 0],
                                  height=0.06,
                                  wrapWidth=1.5),
                  visual.TextStim(win,
                                  proceedInstructions,
                                  pos=[0, -0.3],
                                  height=0.06,
                                  wrapWidth=1.5)
              ])]

    for page in pages:
        __drawPage(win, page, imageList, markerList, textBoxes)
        proceedOrQuit(win)
    return context
def run(context):
    win = context['window']

    screens = [[
        visual.TextStim(win,
                        screen1Text,
                        pos=[0, 0],
                        height=0.06,
                        wrapWidth=1.6)
    ],
               [
                   visual.TextStim(win,
                                   screen2Text,
                                   pos=[0, 0],
                                   height=0.06,
                                   wrapWidth=1.6)
               ],
               [
                   visual.TextStim(win,
                                   screen3Text,
                                   pos=[0, 0],
                                   height=0.06,
                                   wrapWidth=1.6),
                   visual.ImageStim(win,
                                    image='changePoints.bmp',
                                    mask=None,
                                    units='norm',
                                    pos=[-.1, -0.25],
                                    size=[0.88, 1])
               ],
               [
                   visual.TextStim(win,
                                   screen4Text,
                                   pos=[0, 0],
                                   height=0.06,
                                   wrapWidth=1.6)
               ]]

    currentScreen = 0
    numScreens = len(screens)

    while currentScreen < numScreens:
        __drawScreen(win, screens[currentScreen])
        input = proceedOrQuit(win, keys=['escape', 'lshift', 'space'])
        if input == ['lshift']:
            if currentScreen > 0: currentScreen -= 1
        if input == ['space']:
            currentScreen += 1

    return context
示例#13
0
def run(context):
    win = context['window']
    imageList = context['imageList']
    markerList = context['markerList']
    question = """
    Did one of the images change during this trial? 
                         
                                     (y/n)"""
    quiz1 = visual.TextStim(win, question, pos=[0, 0], height=0.06)

    quiz1.draw()
    __drawImages(imageList, markerList)
    win.flip()

    yesNo = '.'
    whichImage = '.'
    howManyTimes = '.'

    gettingInput = True
    quizQuestions = False
    while gettingInput:
        input = proceedOrQuit(win, keys=['escape', 'y', 'n'])
        for thisKey in input:
            if thisKey in ['n']:
                yesNo = thisKey
                gettingInput = False
            if thisKey in ['y']:
                yesNo = thisKey
                gettingInput = False
                quizQuestions = True
    if quizQuestions:
        quiz1.setText('          Which image changed during the trial?' +
                      '\n\n' +
                      'Press the letter key that corresponds to the image.')
        quiz1.draw()
        __drawImages(imageList, markerList)
        win.flip()
        gettingInput = True
        while gettingInput:
            input = proceedOrQuit(win, keys=['escape', 'a', 'b', 'c', 'd'])
            for thisKey in input:
                if thisKey in ['a', 'b', 'c', 'd']:
                    whichImage = thisKey
                    gettingInput = False
        quiz1.setText('How many times did image ' + thisKey +
                      ' change during the trial?' +
                      '\n\n          Please enter a number between 1 and 9')
        quiz1.draw()
        __drawImages(imageList, markerList)
        win.flip()
        gettingInput = True
        while gettingInput:
            #changed from original for all key boards
            input = proceedOrQuit(
                win,
                keys=['escape', '1', '2', '3', '4', '5', '6', '7', '8', '9'])
            for thisKey in input:
                if thisKey in ['1', '2', '3', '4', '5', '6', '7', '8', '9']:
                    howManyTimes = thisKey
                    gettingInput = False
    # forced choice of highest frequency image
    validKeys = ['a', 'b', 'c', 'd']
    # prompt for input of most frequent image to least frequent image
    text = """
     During the trial, it may have appeared that some images were rotating more frequently than 
        were other images. Please rank the 4 images from the trial in order of the image that 
                 rotated MOST frequently to the image that rotated LEAST frequently. 
                 For each choice, press the letter key that corresponds to the image."""

    forcePrompt = visual.TextStim(win,
                                  text,
                                  pos=[0, .2],
                                  height=0.06,
                                  wrapWidth=1.4)
    forceAns1 = visual.TextStim(
        win,
        'Most frequent: ',  # most frequent image input
        pos=[0, -0.2],
        height=0.06,
        wrapWidth=1.4)
    forcePrompt.draw()
    forceAns1.draw()
    __drawImages(imageList, markerList)
    win.flip()
    gettingInput = True
    while gettingInput:
        input = event.waitKeys()
        for thisKey in input:
            if thisKey in validKeys:
                first = thisKey
                validKeys.remove(thisKey)
                gettingInput = False
    # second most frequent image prompt & input
    forceAns1.setText('Most frequent: ' + first)
    forceAns2 = visual.TextStim(win,
                                '2nd most frequent: ',
                                pos=[0, -0.3],
                                height=0.06,
                                wrapWidth=1.4)
    forcePrompt.draw()
    forceAns1.draw()
    forceAns2.draw()
    __drawImages(imageList, markerList)
    win.flip()
    gettingInput = True
    while gettingInput:
        input = event.waitKeys()
        for thisKey in input:
            if thisKey in validKeys:
                second = thisKey
                validKeys.remove(thisKey)
                gettingInput = False
    # third most frequent image prompt & input
    forceAns2.setText('2nd most frequent: ' + second)
    forceAns3 = visual.TextStim(win,
                                '3rd most frequent: ',
                                pos=[0, -0.4],
                                height=0.06,
                                wrapWidth=1.4)
    forcePrompt.draw()
    forceAns1.draw()
    forceAns2.draw()
    forceAns3.draw()
    __drawImages(imageList, markerList)
    win.flip()
    gettingInput = True
    while gettingInput:
        input = event.waitKeys()
        for thisKey in input:
            if thisKey in validKeys:
                third = thisKey
                validKeys.remove(thisKey)
                gettingInput = False
    # fourth most frequent image prompt & input
    forceAns3.setText('3rd most frequent: ' + third)
    forceAns4 = visual.TextStim(win,
                                '4th most frequent: ',
                                pos=[0, -0.5],
                                height=0.06,
                                wrapWidth=1.4)
    forcePrompt.draw()
    forceAns1.draw()
    forceAns2.draw()
    forceAns3.draw()
    forceAns4.draw()
    __drawImages(imageList, markerList)
    win.flip()
    gettingInput = True
    while gettingInput:
        input = event.waitKeys()
        for thisKey in input:
            if thisKey in validKeys:
                fourth = thisKey
                validKeys.remove(thisKey)
                gettingInput = False

    context['changeQuizResults'] = {
        'yesNo': yesNo,
        'whichImage': whichImage,
        'howManyTimes': howManyTimes,
        'first': first,
        'second': second,
        'third': third,
        'fourth': fourth
    }

    if context['collectData']:
        __setData(context)

    return context
示例#14
0
def run(context):
    win = context['window']

    demoPicA = 'demo_a.jpg'
    demoPicB = 'demo_b.jpg'
    demoPic = visual.ImageStim(win,
                               image=demoPicA,
                               mask=None,
                               units='norm',
                               pos=[0, -0.1],
                               size=[0.45, 0.6])
    instructions = [
        visual.TextStim(win,
                        instructions1Text,
                        pos=[0, 0.85],
                        height=0.07,
                        wrapWidth=1.5),
        visual.TextStim(win,
                        instructions2Text,
                        pos=[0, 0.50],
                        height=0.07,
                        wrapWidth=1.5),
        visual.TextStim(win,
                        instructions3Text,
                        pos=[0, -0.65],
                        height=0.06,
                        wrapWidth=1.5),
    ]

    rotateSpeed = context['options']['speed']
    screenStim = visual.TextStim(win,
                                 screen4Text,
                                 pos=[0, 0],
                                 height=0.07,
                                 wrapWidth=1.5)
    pressSpaceStim = visual.TextStim(win,
                                     pressSpace,
                                     height=0.06,
                                     pos=[0, -0.8],
                                     wrapWidth=1.7)

    __welcomeAndSummary(win)

    #display instruction screen 2
    drawInstructions(win, instructions, demoPic)
    proceedOrQuit(win)

    #loop that changes from demo image A to B
    gettingInput = True
    a = True
    while gettingInput:
        __rotateDemoImage(win, demoPic, rotateSpeed, demoPicB, instructions)

        #define instructions screen 3
        instructions[2].setText(instructions3Alt)

        #display instructions screen 1-3
        drawInstructions(win, instructions, demoPic)

        #wait for key press -- if 'escape' pressed close program
        input = proceedOrQuit(win)
        if 'space' in input:
            gettingInput = False

    # introduction screen 3
    instructions[2].setText(instructions3Answer)
    drawInstructions(win, instructions, demoPic)
    proceedOrQuit(win)

    gettingInput = True
    while gettingInput:
        __rotateDemoImage(win, demoPic, rotateSpeed, demoPicA, instructions)

        drawInstructions(win, instructions, demoPic)

        #wait for key press -- abort on escape
        input = proceedOrQuit(win)
        if 'space' in input:
            gettingInput = False

    #screen4(win, screenStim)
    #input = proceedOrQuit(win)

    return context
示例#15
0
def run(context):
    win = context['window']
    pressSpaceStim = visual.TextStim(win,
                                     pressSpace,
                                     height=0.06,
                                     pos=[0, -0.8],
                                     wrapWidth=1.7)
    pressSpaceStim_task2 = visual.TextStim(win,
                                           pressSpace_task2,
                                           height=0.06,
                                           pos=[0, -0.8],
                                           wrapWidth=1.7)
    pressSpaceStim_fin = visual.TextStim(win,
                                         pressSpace_fin,
                                         height=0.06,
                                         pos=[0, -0.8],
                                         wrapWidth=1.7)

    pages = [
        [
            pressSpaceStim_task2,
            visual.TextStim(win,
                            introTask,
                            pos=[0, 0],
                            height=0.1,
                            wrapWidth=1.7),
        ],
        [
            pressSpaceStim,
            visual.TextStim(win,
                            summaryText,
                            pos=[0, 0],
                            height=0.07,
                            wrapWidth=1.7),
            visual.ImageStim(win,
                             image='trustDemo1.jpg',
                             mask=None,
                             units='norm',
                             pos=[0, -0.1],
                             size=[0.88, 1.0])
        ],
        [
            pressSpaceStim,
            visual.TextStim(win,
                            summaryText2,
                            pos=[0, 0],
                            height=0.07,
                            wrapWidth=1.7),
            visual.ImageStim(win,
                             image='trustDemo2.jpg',
                             mask=None,
                             units='norm',
                             pos=[0, -0.1],
                             size=[0.88, 1.0])
        ],
        [
            pressSpaceStim_fin,
            visual.TextStim(win,
                            title,
                            pos=[0, 0.8],
                            height=0.1,
                            wrapWidth=1.7),
            visual.TextStim(win,
                            gameRoles,
                            pos=[0, 0],
                            height=0.07,
                            wrapWidth=1.7)
        ],
        [
            pressSpaceStim,
            visual.TextStim(win,
                            transitiontext,
                            pos=[0, 0],
                            height=0.07,
                            wrapWidth=1.7)
        ],
        [
            pressSpaceStim,
            visual.TextStim(win,
                            summaryTextA,
                            pos=[0, 0.05],
                            height=0.07,
                            wrapWidth=1.7),  #working here
            visual.ImageStim(win,
                             image='demoPicA.jpg',
                             mask=None,
                             units='norm',
                             pos=[0, -0.1],
                             size=[0.88, 1.0])
        ],
        [
            pressSpaceStim,
            visual.TextStim(win,
                            summaryTextB,
                            pos=[0, 0.05],
                            height=0.07,
                            wrapWidth=1.7),
            visual.ImageStim(win,
                             image='demoPicB.jpg',
                             mask=None,
                             units='norm',
                             pos=[0, -0.1],
                             size=[0.88, 1.0])
        ],
        [
            pressSpaceStim,
            visual.TextStim(win,
                            summaryTextC,
                            pos=[0, 0.05],
                            height=0.07,
                            wrapWidth=1.7),
            visual.ImageStim(win,
                             image='demoPicC.jpg',
                             mask=None,
                             units='norm',
                             pos=[0, -0.1],
                             size=[0.88, 1.0])
        ],
        [
            pressSpaceStim,
            visual.TextStim(win,
                            summaryTextD,
                            pos=[0, 0.05],
                            height=0.07,
                            wrapWidth=1.7),
            visual.ImageStim(win,
                             image='demoPicD.jpg',
                             mask=None,
                             units='norm',
                             pos=[0, -0.1],
                             size=[0.88, 1.0])
        ],
        [
            pressSpaceStim,
            visual.TextStim(win,
                            summaryTextE,
                            pos=[0, 0.05],
                            height=0.07,
                            wrapWidth=1.7),
            visual.ImageStim(win,
                             image='demoPicE.jpg',
                             mask=None,
                             units='norm',
                             pos=[0, -0.1],
                             size=[0.88, 1.0])
        ],
        [
            pressSpaceStim,
            visual.TextStim(win,
                            summaryTextF,
                            pos=[0, 0.05],
                            height=0.07,
                            wrapWidth=1.7),
            visual.ImageStim(win,
                             image='demoPicF.jpg',
                             mask=None,
                             units='norm',
                             pos=[0, -0.1],
                             size=[0.88, 1.0])
        ],
        [
            pressSpaceStim,
            visual.TextStim(win,
                            summaryTextG,
                            pos=[0, 0.05],
                            height=0.07,
                            wrapWidth=1.7),
            visual.ImageStim(win,
                             image='demoPicG.jpg',
                             mask=None,
                             units='norm',
                             pos=[0, -0.1],
                             size=[0.88, 1.0])
        ],
        [
            pressSpaceStim,
            visual.TextStim(win,
                            summaryTextH,
                            pos=[0, 0.05],
                            height=0.07,
                            wrapWidth=1.7),
            visual.ImageStim(win,
                             image='demoPicH.jpg',
                             mask=None,
                             units='norm',
                             pos=[0, -0.1],
                             size=[0.88, 1.0])
        ],
        [
            pressSpaceStim,
            visual.TextStim(win,
                            summaryTextI,
                            pos=[0, 0.15],
                            height=0.06,
                            wrapWidth=1.7),
            visual.ImageStim(win,
                             image='demoPicI.jpg',
                             mask=None,
                             units='norm',
                             pos=[0, -0.1],
                             size=[0.88, 1.0])
        ],
        [
            pressSpaceStim,
            visual.TextStim(win,
                            summaryText3,
                            pos=[0, 0.7],
                            height=0.07,
                            wrapWidth=1.7),
            visual.ImageStim(win,
                             image='trustDemo3.jpg',
                             mask=None,
                             units='norm',
                             pos=[0, -0.1],
                             size=[0.88, 1.0])
        ]
    ]
    for page in pages:
        for stim in page:
            stim.draw()
        win.flip()
        proceedOrQuit(win)

    return context
示例#16
0
def run(context):
    imageList = context['imageList']
    markerList = context['markerList']
    win = context['window']
    isDemo = context['trustGameDemo']
    textBoxes = gameTextBoxes(win)
    instructions = [
        visual.TextStim(win, instructions1, pos=[0,0.4],height=0.06,wrapWidth=1.5),
        visual.TextStim(win, moveToInstrutions, pos=[0,0.1], height=0.06,wrapWidth=1.5)
    ]
    currentMover = textBoxes[-1]
    prompt = visual.TextStim(win, confirmPrompt, height=0.06)
    players = { 'a': 0, 'b': 1, 'c': 2, 'd': 3 }

    giftOrder = []

    currentTarget = 0
    lastTarget = 0
    stillDeciding = True
    while stillDeciding:
        stillGivingToPlayers = True
        while stillGivingToPlayers:
            prompt.setText(selectTargetPrompt)
            prompt.draw()
            drawBoard(win, imageList, markerList, textBoxes)
            input = proceedOrQuit(win, keys=['escape', 'A', 'B', 'C', 'D', 'a', 'b', 'c', 'd', 'N', 'n'])
            lastTarget = currentTarget
            inputLetter = input[0].lower()
            collectingAmount = True if inputLetter != 'n' else False

            if inputLetter != 'n':
                currentTarget = players[inputLetter]
                moverTarget = textBoxes[currentTarget]
                setMoverTarget(textBoxes, lastTarget, currentTarget)
                drawInstructions(currentTarget, instructions)
                drawBoard(win, imageList, markerList, textBoxes)

            while collectingAmount:
                keys = ['space', 'escape', 'up', 'down']
                moverTargetAmount = getTextBoxAmount(moverTarget)
                input = proceedOrQuit(win, keys = keys)
                if 'up' in input:
                    updateTarget = decrementAmount(currentMover, mover=True)
                    if updateTarget:
                        incrementAmount(moverTarget, moverTargetAmount)
                elif 'down' in input:
                    updateTarget = incrementAmount(currentMover, moverTargetAmount, mover=True)
                    if updateTarget:
                        decrementAmount(moverTarget)
                elif 'space' in input:
                    collectingAmount = False

                drawInstructions(currentTarget, instructions)
                drawBoard(win, imageList, markerList, textBoxes)

                if context['collectData']:
                    if currentTarget not in giftOrder:
                        giftOrder.append(currentTarget)
            prompt.setText(continuePrompt)
            prompt.draw()
            drawBoard(win, imageList, markerList, textBoxes)
            input = proceedOrQuit(win, keys=['escape', 'y', 'n'])
            if 'n' in input:
                stillGivingToPlayers = False


        prompt.setText(confirmPrompt)
        prompt.draw()
        drawBoard(win, imageList, markerList, textBoxes)
        input = proceedOrQuit(win, keys=['escape', 'y', 'n'])
        if 'y' in input:
            stillDeciding = False

    if context['collectData']:
        __setData(context, giftOrder, textBoxes, [imageStim.image for imageStim in imageList])

    return context
示例#17
0
def run(context, collectData=False):
    win = context['window']
    imageList = context['imageList']
    answers = __initAnswersArray()

    ratingInstructions1 = visual.TextStim(win,
                                          ratingScaleText,
                                          pos=[0, 0.70],
                                          height=0.04,
                                          wrapWidth=0.95)
    ratingInstructions2 = visual.TextStim(
        win,
        'Press the SPACE key after each response to continue.',
        pos=[0, -0.7],
        height=0.05,
        wrapWidth=0.9)

    rating1 = visual.TextStim(win,
                              question1Text,
                              pos=[0, 0.45],
                              height=0.05,
                              wrapWidth=1.5)
    rating2 = visual.TextStim(win,
                              question2Text,
                              pos=[0, 0.33],
                              height=0.05,
                              wrapWidth=1.5)
    rating3 = visual.TextStim(win,
                              question3Text,
                              pos=[0, 0.21],
                              height=0.05,
                              wrapWidth=1.5)
    rating4 = visual.TextStim(win,
                              question4Text,
                              pos=[0, 0.09],
                              height=0.05,
                              wrapWidth=1.5)
    rating5 = visual.TextStim(win,
                              question5Text,
                              pos=[0, -0.03],
                              height=0.05,
                              wrapWidth=1.5)
    rating6 = visual.TextStim(win,
                              question6Text,
                              pos=[0, -0.15],
                              height=0.05,
                              wrapWidth=1.5)
    rating7 = visual.TextStim(win,
                              question7Text,
                              pos=[0, -0.27],
                              height=0.05,
                              wrapWidth=1.5)

    rating1a = visual.TextStim(win,
                               yourAnswer,
                               pos=[0, 0.39],
                               height=0.05,
                               wrapWidth=1.5)
    rating2a = visual.TextStim(win,
                               yourAnswer,
                               pos=[0, 0.27],
                               height=0.05,
                               wrapWidth=1.5)
    rating3a = visual.TextStim(win,
                               yourAnswer,
                               pos=[0, 0.15],
                               height=0.05,
                               wrapWidth=1.5)
    rating4a = visual.TextStim(win,
                               yourAnswer,
                               pos=[0, 0.03],
                               height=0.05,
                               wrapWidth=1.5)
    rating5a = visual.TextStim(win,
                               yourAnswer,
                               pos=[0, -0.09],
                               height=0.05,
                               wrapWidth=1.5)
    rating6a = visual.TextStim(win,
                               yourAnswer,
                               pos=[0, -0.21],
                               height=0.05,
                               wrapWidth=1.5)
    rating7a = visual.TextStim(win,
                               yourAnswer,
                               pos=[0, -0.33],
                               height=0.05,
                               wrapWidth=1.5)

    ratingVisuals = {
        'instructions': [ratingInstructions1, ratingInstructions2],
        'questions': [(rating1, rating1a), (rating2, rating2a),
                      (rating3, rating3a), (rating4, rating4a),
                      (rating5, rating5a), (rating6, rating6a),
                      (rating7, rating7a)]
    }

    for x in imageList:
        x.setOri(0)

    for screen, image in enumerate(imageList):
        question = 0
        while question < 7:
            __drawRatings(win, image, ratingVisuals, screen, question, answers)

            input = proceedOrQuit(win,
                                  keys=[
                                      'escape', 'lshift', 'space', '1', '2',
                                      '3', '4', '5', '6', '7'
                                  ])
            proceed = __handleRangeInput(input, screen, question, answers)
            if proceed < 0 and question > 0:
                question -= 1
            elif proceed > 0 and answers[screen][question] != '':
                question += 1

    if context['collectData']:
        __setData(context, answers)

    return context