Hello. I am trying to build a Maze task using Psychopy. But there are several issues that cannot solve as my lack of knowledge. If you help me out this problem, I will be really appreciate it.
- Procedure of my experiment.
I will present the sentence by breaking it down into words and showing the ‘w’ position with both the target word and inferent word simultaneously. For example, if the sentence is “Cheolsu ate w rice.”, I will display it as “Cheolsu”, “ate”, “w”, “rice.”. At that time, both of “yesterday” and “today” appearing in the place of ‘w’.
When words other than ‘w’ are shown, subjects should press the spacebar as a response key. When the target and inferent appear in the ‘w’ position, they can press the left and right arrow keys to response. Additionally, I will make sure that the target/inferent positions are counterbalanced (target-inferent or inferent-target). The correct response will be indicated by pressing the corresponding arrow key based on the target’s position.
- This is my code which is written on the code properties on the builder.
##begin experiment
import pandas as pd
df3 = pd.read_excel(‘/Users/haejinkim/Documents/practice/prac1.xlsx’, sheet_name = 0, header = 0)
conditionsFile = ‘prac1.xlsx’
from psychopy import visual, core, event
##begin routine
def get_user_input(directions):
return event.waitKeys(keyList = [‘space’, directions[direction_idx]])[0]
directions = [‘left’, ‘right’]
direction_idx = 0
win = visual.Window(size=[2416,1359], fullscr=True)
text_component = visual.TextStim(win)
for i in range(len(df3)):
objWord = df3.loc[i]
sent = str(objWord['Sentence']).split()
target = str(objWord['target_word'])
inferent = str(objWord['inferent_word'])
text_component.text = '' .join(sent) + '' + target + '' + inferent
for word in sent:
kes = get_user_input(directions)
if word == 'w':
text_component.draw(target + '' + inferent)
target_direction = directions[direction_idx]
win.flip()
elif word != 'w':
text_component.draw(word)
event.waitKeys()
end routine
win.close()
- Problem
Problem is there are no error code but it does not print any word also. Please help me anyone who have any idea!!