| Reference | Downloads | Github

Possible to generate other types of element with ElementArrayStim?


This might sound like a beginner question, but is it possible to create other types of element (ie. a text or a .jpg image) other that the standard gabor (or dots) patches? For example, I want to have 50 random crosses or 50 random images to be generated on the screen.

The API at doesn’t seem to elaborate much on this, or at least, it doesn’t seem like there is an option to do so.


Images will work as the type of element in ElementArrayStim; you can provide the filename as the elementTex option. For crosses, you can set elementTex=None and elementMask="cross".


Thanks! That worked. Just two follow up questions - 1) is there a list of possible other items that can be inserted apart from crosses? And also, 2) what about text in the form of words or digits in place of crosses and dots? How do you go about duplicating those?

  1. I’m not sure if it is actually documented anywhere, but the code that generates the textures is at psychopy.visual.basevisual.TextureMixin._createTexture (current) and the options can be seen there.

  2. You could perhaps use BufferImageStim to render a text stimulus and then use the result as the texture for an ElementArrayStim. But that gets a bit tricky with the alpha channel, so you are probably best to just implement the ElementArrayStim functionality manually (i.e. draw your text stimulus multiple times, updating its pos attribute each time), if that is feasible time-wise.