psychopy.org | Reference | Downloads | Github

Drawing Multiple visual.ElementArrayStim objects

OS (e.g. Win10): Ubunutu 18.04 LTS
PsychoPy version (e.g. 1.84.x): v2020.2.3
Standard Standalone? (y/n):" Yes
What are you trying to achieve?: Creating multiple visual.ElementArrayStim objects

What did you try to make it work?:
I have create two visual.ElementArrayStim objects of different sizes and parameter.
When I try to setAutoDraw(True) each of these objects at the same time I get the below error message at the point where the second object is drawn.
I have found that if I remove the setAutoDraw(True) for stim1 the stim2 will now display without error. It seems like there is some crossover between the objects where the 1st object causes the 2nd object to error?

What specifically went wrong when you tried that?:
Traceback (most recent call last):
File “/home/jrobinson/Documents/gdrive/PostDoc/Templton/inattenBlind/NEWTEST.py”, line 277, in
dist2_poly.setAutoDraw(True)
File “/home/jrobinson/.local/lib/python3.6/site-packages/psychopy/visual/basevisual.py”, line 179, in setAutoDraw
setAttribute(self, ‘autoDraw’, value, log)
File “/home/jrobinson/.local/lib/python3.6/site-packages/psychopy/tools/attributetools.py”, line 141, in setAttribute
setattr(self, attrib, value)
File “/home/jrobinson/.local/lib/python3.6/site-packages/psychopy/tools/attributetools.py”, line 32, in set
newValue = self.func(obj, value)
File “/home/jrobinson/.local/lib/python3.6/site-packages/psychopy/visual/basevisual.py”, line 161, in autoDraw
iis = numpy.where(depthArray < self.depth)[0]
TypeError: ‘<’ not supported between instances of ‘attributeSetter’ and ‘attributeSetter’

Issue solved, I should have been using the dist2_poly.draw(win) as no .autoDraw method is not present for visual.ElementArrayStim.

Hello Robin,

May I ask you how have you done to use the ElementArray function in the Builder.

I tried many things but it still doesn’t work.

If you can tell me the instrictions to put in the different tab of the ‘code’ in the Builder, it would be great.