AnnaPy
November 24, 2021, 3:12pm
1
Hello everyone,
I am very new to this and am currently using PsychoPy for the first time. For an experiment I have to make a Code, that makes the mouse appear in a certain position on the screen depending on a variable in my Excel file.
Up to now I have the following code:
starting_position1 = [-75, -40]
starting_position2 = [75, -40]
if (‘mouse’) == 1:
mouse.setPos = starting_position1
else :
mouse.setPos = starting_position2
and the following error message in PsychoPy:
mouse.setPos = starting_position2
AttributeError: ‘int’ object has no attribute ‘setPos’
I guess it might be cause PsychoPy can’t find the “mouse” variable. How do I tell PsychoPy to look for the variable in the Excel file?
Becca
November 24, 2021, 5:43pm
2
Hi there,
try having one column for the mouse x position and a seperate column for the y position.
Then in your experiment add a mouse component (e.g. called mouse
)
then add a code component and in the begin routine tab use:
mouse.setPos(myX myY)
(where myX and myY correspond to your column headers
Hope this helps.
Becca
AnnaPy
November 25, 2021, 9:42am
3
I don’t know if I did it right, but if I put your code, I also get the following message:
mouse.setPos(myx,myy)
AttributeError: ‘int’ object has no attribute ‘setPos’
Experiment ended.
Even though I defined myx and myy in the Excel sheet.
Becca
November 25, 2021, 11:31am
4
what is the name of your mouse component? replace mouse
with the name of the component
AnnaPy
November 25, 2021, 12:23pm
5
The component is called “mouse”.