| Reference | Downloads | Github

Presenting TextStm and Circle objects at the center of the screen: surprising offset


This screen capture illustrates the issue: Capture

I first present a fixation cross at the center of the screen using:

fixation = visual.TextStim(win=win, ori=0,
pos=[0, 0], height=1.,
color=[0,255,0], colorSpace=u’rgb255’)

Then I present a small dot using the Circle() method:

radius_dot = 0.04
n_edges = 32
dot_center = visual.Circle(win, ori=0,pos=[0,0], radius = radius_dot, edges = n_edges,lineColor= [255,255,255], fillColor= [255,255,255], fillColorSpace=u’rgb255’,lineColorSpace=‘rgb255’)

As you can see, the letter + and the dot are not centered. The dot is slightly shifted upwards. Why? How can I fix this?


No, the dot is precisely at the centre of the screen.

The issue is because your plus sign comes from a font, and font characters can be drawn in all sorts of ways. If you changed font, the location would shift somewhat depending on the nature of that particular font’s styling. PsychoPy can’t meaningfully know what the “centre” of any particular glyph is. You might think it is easy for a ‘+’ sign, but what about a ‘G’ or a lower case ‘g’? They all need to align, based on what the font thinks is their baseline, not some arbitrary geometric consideration.

So in essence, a ‘+’ sign from a font is only ever a quick and dirty fixation symbol. If you are serious about its geometrical properties, you should specify it precisely (i.e. geometrically) rather than relying on an arbitrary font glyph.

Actually, Builder is about to get a new “fixation” component, which will do this for you. But for the time being, you should construct it yourself, e.g. using two polygon stimuli (i.e. two lines that cross at their centres).