I have a experiment running in Fullscreen mode with a viewScale factor so the section of interest is smaller than the full screen size. I want the borders (like a letterboxed video) to be black, but I want the background color in the center section (the screensize * viewScale) to be gray. Specifically, when I call textStim to add text to the screen, I want the edge of the screen to be black but the center to be gray (http://www.psychopy.org/api/visual/textstim.html?highlight=textstim#psychopy.visual.TextStim)
I havenāt found a function yet to do this. Is this kind of functionality supported or should I try to use a .png image for the background?
There are a massive number of stimulus arrangements people need. PsychoPy generally caters for this by providing simple stimulus classes that can be combined as needed, rather than providing specific stimuli or functions for particular arrangements.
So you should think less along the lines of āis there a function for thisā and more along the lines of āhow would I draw thisā? In this case, effectively you just want to draw a rectangle in the middle of the screen that is different to the background colour.
Given that you know the size of the desired central area, at the beginning of the experiment, just create a rectangular ShapeStim (http://www.psychopy.org/api/visual/shapestim.html) with those dimensions, centred at position (0,0), and coloured grey, and draw it before other stimuli so that it appears as the background to them.
You can control the colour of the ābordersā by simply specifying the color attribute of the window when it is created (http://www.psychopy.org/api/visual/window.html#psychopy.visual.Window). i.e. the black background colour of the window acts as the background of the central grey rectangle you draw.
However now that the box is drawing Iām realizing the viewScale is not changing the placement of my instruction text. I use the height units for placing instruction text. Now Iām thinking perhaps the easiest way is to simply multiply the height value by the viewScale before assigning it, since it seems height is relative to the Window size, which is not changed by viewScale.
Please correct me if Iām wrong in any part of my understanding of height, units, window, and viewScale.
Great. Just make sure that you only create the grayBox stimulus once (e.g. at the start of the experiment). You donāt need to re-create it every time you display instructions (in general, object creation is a time-expensive process, compared to adjusting the properties of a stimulus that already exists.
Iām a bit lost about what you want to achieve with your text stimulus. You should give us concrete details of how you calculate your āviewScaleā variable and precisely what you want to specify for the text stimulus location.