0

How should I debug this code?

Using PsychoPy (a software under Python) I randomize (shuffle) the positions of three text. Now, I want to make an associatin between text position and key press (named Chouce.keys). I wrote this line: if textA.pos== [0,0] and Choice.keys [0]== 'right': chosenText= A but I faced this error: value Error: the truth value of an array with more than one element is ambiguous. Use a.any() ora.all(). What does this error want? What should I do? I appreciate any advice.

4th Mar 2018, 1:30 PM
Omidreza Ghasemi
Omidreza Ghasemi - avatar
3 ответов
+ 4
Use parenthesis maybe to specify explicitly which are the boolean conditions you want to check.
4th Mar 2018, 1:45 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
Please post your code here in the Code Playground, maybe I'm not seeing it right.
4th Mar 2018, 7:02 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
Thank you for your answer. Is that what you mean? if (textA.pos==[0,0]) and (Choice.keys [0]=='right'): chosenText= A The same error appears
4th Mar 2018, 6:36 PM
Omidreza Ghasemi
Omidreza Ghasemi - avatar