psychopy.org | Reference | Downloads | Github

TypeError: len() of unsized object - changing orientation of a line

Hello everyone,

I want to rotate a line when the mouse is clicked in a circle. I added the following code in the builder:

if mouse1_draw.isPressedIn(peg1_draw):
    arrow_draw.ori += 90

Unfortunately. I get the following error message:

TypeError: len() of unsized object

What do I have to change to make things work? Thank you in advance.

By trial and error, I specified in the “Begin Experiment” category the orientation of the line with this code:

arrow_draw.ori = 0

It worked, but I am still eager for an an explanation why I had to define the orientation again. :slight_smile: