psychopy.org | Reference | Downloads | Github

Randomising text position with shuffle()


#1

I have 4 text stimuli which I want to randomise their locations.
I did this at the beginning of routine

Posi=[’[4.95,0]’,’[-4.95,0]’,’[0,4.95]’,’[0,-4.95]’]
shuffle(Posi)

Then, turning to the builder, I typed
$Posi[0], $Posi[1] in the ‘position’ column and so on, for the 4 stmuli. I also set that to ‘set every repeat’

But I keep getting this
ValueError: could not convert string to float: [-4.95,0]

I don’t understand how I should change the input, because there is no problem if I just plainly put [x,y] into position.

Thanks!


#2

Your quotes are telling python to treat the entries as text, rather than as pairs of numbers. '[4.95,0]' is a string (text) and its zeroth element is simply '['

Take out your quotes and this might work