Alignment of textStim calculating precise coordinates

Hi, I ran an eye tracking experiment where the position of stimuli (all were single-line sentences) on the screen was defined like this:
pword = visual.TextStim(win, text=psentence, color=[.8,.8,.8], alignText = ‘left’,pos=[0,0], ori=0, font=‘Courier New’, height=25, wrapWidth=1720).

So the initial letter of each sentence appeared in the same position (as far as I could see).
For the analyses, I need to know the precise position of the initial letter.

Is there a way to calculate that? I’m pretty confident that I found the right coordinates (100,550) by superimposing the screenshots generated during the experiment and the images I generated with the package I’m using for extracting fixation information (eyekit API documentation), but it would be much better to know it for certain.

Entire experiment is written in Python 3.6.6.

I’m not sure you can get the exact pixel location of the first letter of text from a visual.TextStim object. Since you already ran the experiment and have screen captures of the displayed text, your current approach of using those to find the the letter location maybe the most accurate option right now.

In the future, if you are OK using monospaced fonts, you may want to try using the TextBox stim, which can give you the exact pixel position of each letter of displayed text, allowing you to save it for future reference / analysis purposes. The textbox_glyph_placement.py demo shows some of this functionality.

There were a couple TextBox drawing issues on macOS and Linux, but those have been fixed in the latest source code and will be included in the next official release.

Hi sol,

Thank you for the suggestions, I’ll definitely explore them for the next experiment.
I use Windows so it shouldn’t be a problem.