我试图显示一组在大约25秒的时间内动态变化的数字,同时显示视觉刺激,作为对象的反馈。响应。但是,似乎脚本无法一次执行这两个任务。任何人都可以想到任何类型的工作吗?非常感谢任何帮助。我对python / psychopy很新,所以如果代码有点乱,我道歉。
这是我目前的代码:
开始常规
if not countdownStartedIndie:
countdownClock = core.CountdownTimer(26)
countdownStartedIndie = True
if not countupto:
timer = core.Clock()
avgtaps = 0
countupto = True
每个框架
timeRemaining = countdownClock.getTime()
ValueWin = visual.TextStim(win, text='+', font='', pos=(-0.5, -0.5), depth=0, rgb=None, color=('limegreen'), colorSpace='rgb', opacity=1, contrast=1.0, units='', ori=0.0, height=0.3, antialias=True, bold=False, italic=False, alignHoriz='center', alignVert='center', fontFiles=(), wrapWidth=None, flipHoriz=False, flipVert=False, name=None, autoLog=None)
timetogo = timer.getTime()
if timetogo >= 25:
countupto = False
else:
minutes2 = int(timetogo/60)
seconds2 = int(timetogo -(minutes2*60))
if timeRemaining <= 0.0:
s4.finished = True
continueRoutine = False
countdownStartedIndie = False
else:
minutes = int(timeRemaining/60) # the integer number of minutes
seconds = int(timeRemaining -(minutes*60))
timeText = str(minutes)+ ':' + str(seconds) #create a string of characters representing time
if s4keys.corr:
ValueWin.draw #visual player feedback
jitter = [10,11,12,13][randint(0,3)]
groupcount = 'x' + str(jitter)
for frameN in range (48):
s4count.draw() #a text stim using the 'groupcount' variable
win.flip()
答案 0 :(得分:0)
我可以提供一个更一般的例子,你可以希望它适应你的情况。希望通过将其切割成骨头,一般原则更容易理解。
$sql = "SELECT * FROM $table
WHERE 'id' = $id";
$result = $mysqli->query($sql);
while ($row = mysqli_fetch_assoc($result)){
$firstname = $row['firstname']; $lastname = $row['lastname'];
//and so on for other fields
}
当然,你可以有更多的刺激,做更精细的反馈,更改更多的功能等。在你的情况下,你可能会改变刺激文本而不是位置和颜色。