| Reference | Downloads | Github

TypeError: visual.Line is not a constructor

URL of the experiment:

I am getting the error

  • TypeError: visual.Line is not a constructor

when trying to construct a line with that function.

This question has been reposted from here. You can have a look at the suggestions.

Interesting. Try defining it as a shapeStim or rect that is very long and thin instead of a “line” object. I suspect that the specific “Line” object may not have been translated into PsychoJS since it is basically a derivative of shapeStim anyways.

1 Like

Ok thanks, apologies I thought you were referring to an issue trying to run in local debug mode.

Yes, as mentioned above by Wakefield and Jonathan, visual.Line is not an object in PsychoJS. According to the PsychoPy code, you need to use ShapeStim :

refline = new visual.ShapeStim ({
                   win: psychoJS.window, 
                   name: "refline", 
                   units: "height",
                   vertices: [[-size[0]/2.0, 0], [+size[0]/2.0, 0]],
                   //... and all other params

1 Like

In this regard, it might be prudent to look at the Psychopy.js documentation. They have all the available classes with their attributes listed.

1 Like