Centered text issue
Hi there,
I am using opensesame for a few month now, and recently i've noticed an issue with the centering of a text.
I wanted to create a circle with an asterisk inside of it. I gave the center of the circle and the center of the text the same values, but the asterisk wasn't centered.
Consider this code:
cv = Canvas() cv.line(sx=-200, sy=0, ex=200, ey=0) cv.line(sx=0, sy=-200, ex=0, ey=200) cv.circle(x=0, y=0, r=40) cv.text("*", x=0, y=0, center=True, font_size=70) cv.show()
The image i received was this:
Then I thought to compare it to a long character. I tried this: '|'
cv = Canvas() cv.line(sx=-200, sy=0, ex=200, ey=0) cv.line(sx=0, sy=-200, ex=0, ey=200) cv.circle(x=0, y=0, r=40) cv.text("*|", x=0, y=0, center=True, font_size=70) cv.show()
The image I received was this:
The '|' is actually centered, but why is the asterisk suddenly went up?
How can I create an actually centered asterisk inside a circle?
The code above was tested on:
- opensesame 3.2 with python 3 with expyriment backend. (The images was taken from here)
- opensesame 3.1 with python 2.7 with psycopy backend.
Thanks,
Yuval
Comments
Hi Yuval,
This is a known issue with bounding boxes around text leading to sometimes unpredictable positioning. A workaround for that is described here:
This should be fixed in OpenSesame 3.3. (However, the correct positioning for the asterisk will still be a bit above the center, not perfectly centered!)
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!