2

论坛新手,在此先感谢您提供的任何帮助。当用户研究其中包含的信息时,我有一系列.jpgs 正在呈现给用户。说明指出,每个 jpg 最多可以研究 120 秒。我已经对其进行了编码,以便 jpg 将在 120 秒限制之后前进:

    RespKey= []
    RT = []
    event.clearEvents()
    myClock.reset()
    t1example = myClock.getTime()
    t2example = t1example
    while t2example < (t1example+120):    # value added to t1 here is timeout value; 
        RespKey = event.getKeys(keyList=["space"], timeStamped=myClock) # they are told to press space bar when done studying
        if len(RespKey) > 0:
            RT = RespKey[0][1]
            Resp =  RespKey[0][0].lower()
            print Resp
            print RT
            break
        else:
            t2study = myClock.getTime()      # end of timeout loop
    myWin.flip()

问题是,我不知道如何在学习 jpg 时让用户看到时钟/​​计时器/秒表功能。有没有办法在刺激物上叠加一个可见的时钟,这样当学习时间结束时没人会感到惊讶?

注意:编码新手,如果可能的话,请用外行人说话。

谢谢!

4

1 回答 1

1

是的。在循环之前(以及重新设置时钟之前),创建一个像这样的文本刺激:

clockText = visual.TextStim(myWin) # include other parameters if you want to change the default size, font, etc

然后在每一帧上,您将更新该刺激的内容。即在 myWin.flip() 调用之前,执行以下操作:

clockText.setText(str(t2study)) # you can format/round this as required
clockText.draw()

查看 face_jpg.py Coder 演示以获取在每一帧上显示此类文本的示例。

于 2014-08-07T01:49:36.413 回答