首页 > 解决方案 > 一旦我创建了我的评分量表并翻转屏幕,它们就不会出现。我究竟做错了什么?

问题描述

一旦我在 PsychoPy 中创建了评分量表,我就无法在显示我的刺激后显示它们。我究竟做错了什么?

准备实验

定义窗口:

win = visual.Window(fullscr=True, color = 'Black')

准备刺激物

图片

在我的文件夹中制作图像列表:

images = glob.glob("Yellow/*.jpg")

随机排列图片的顺序:

random.shuffle(images)

准备固定十字架

stim_fix_left = visual.TextStim(win, '+')  # Fixation cross is just the character "+". Units are inherited from Window when not explicitly specified.
stim_fix_left.pos = (0.5,0)
stim_fix_right = visual.TextStim(win, '+')  # Fixation cross is just the character "+". Units are inherited from Window when not explicitly specified.
stim_fix_right.pos = (-0.5, 0)

收视率

# the item to-be-rated or respond to:
whichred_left = visual.TextStim(win, text="Does left or right picture contain most red?", height=.04, units='norm')
whichred_left.pos = (0.5,0)
whichred_right = visual.TextStim(win, text="Does left or right picture contain most red?", height=.04, units='norm')
whichred_right.pos = (-0.5, 0)

创造刺激

显示介绍信息:

msg(intro, "white")

显示块介绍:

msg(block_red, "red")

for i in images:
    ##Pictures
    stim_fix_right.draw()
    stim_fix_left.draw()
    win.flip()#flip screen
    core.wait(1.0)

    #Picture 1
    img1 = visual.ImageStim(win, image = i)#create visual stimuli
    img1.pos = (0.4, 0)
    img1.size = (0.5)

    #Picture 2
    img2 = visual.ImageStim(win, image = images[2])#create visual stimuli
    img2.pos = (0.7, 0)
    img2.size = (0.5)

    #Picture 3
    img3 = visual.ImageStim(win, image = i)#create visual stimuli
    img3.pos = (-0.4, 0)
    img3.size = (0.5)
    #Picture 4
    img4 = visual.ImageStim(win, image = images[2])#create visual stimuli
    img4.pos = (-0.7, 0)
    img4.size = (0.5)

    #Drawing picures
    img1.draw()#draw picture
    img2.draw()#draw picture
    img3.draw()#draw picture
    img4.draw()#draw picture
    win.flip()#flip screen
    stopwatch.reset() #set clock
    core.wait(1.0)

    #Ratings
    event.clearEvents()
    # define window
    winrating = visual.Window(size = (1280, 720), color = 'black', units='pix')
    x, y = winrating.size  # for converting norm units to pix
    leftward = -0.35 * x / 2  # use pix units, because the drawing window's units are pix
    rightward = -1 * leftward

    # create a RatingScale object:
    RatingLeft = visual.RatingScale(winrating, choices=map(str, range(1, 8)), mouseOnly=True, pos=(leftward, -y/6),
        marker='circle', size=0.85, name='left')
    RatingRight = visual.RatingScale(winrating, choices=map(str, range(1, 8)), low=0, high=8, markerStart=4,
        leftKeys='left', rightKeys = 'right', acceptKeys='down', pos=(rightward, -y/6),
        marker='circle', size=0.85, name='right')

    while RatingLeft.noResponse or RatingRight.noResponse:
        whichred_left.draw
        whichred_right.draw 
        RatingLeft.draw()
        RatingRight.draw()
        winrating.flip()
        if event.getKeys(['escape']):
            core.quit()

标签: windowratingpsychopy

解决方案


无需定义第二个窗口。在您最初定义的窗口中进行所有绘图,win. 这是作为全屏窗口创建的,因此我假设第二个窗口winrating隐藏在其后面,并且任何绘图都不可见。


推荐阅读