Why does psychopy.visual.TextStim not render text when I set pos=[50,0]?

I would like to render text on to the right side of a visual.Window using visual.TextStim. When I set the position of the TextStim to 0:

my_text = visual.TextStim(win, pos=[0,0])

The text appears on-screen. But when I change this to:

my_text = visual.TextStim(win, pos=[50,0])

for example. The text does not appear. I have tried this using python 3.6, psychopy 1.90.2. How can I use TextStim to display text stimuli to the right of the visual.Window?

Upvotes: 1

Views: 714

Answers (2)

While other stimuli in psychopy take pixel-wise position references, such as MovieStim3:

mov = visual.MovieStim3(win, glob_vid_path, flipVert=False, flipHoriz=False, pos=(-400, 0))   

TextStim does not. Rather the horizontal and vertical reference points are from -1 to 1 corresponding to the left and right (or top and bottom) of the screen. As such, one may position text stimuli to the right of the screen using this for example:

my_text = visual.TextStim(win, pos=[0.5,0])

EDIT: From the comment on this answer and the other correct answer, I see that the units can be explicitly changed.

Upvotes: 3

Jon
Jon

Reputation: 1223

Probably you haven't specified the units for the stimulus:

my_text = visual.TextStim(win, pos=[50,0], units='pix')

my_text = visual.TextStim(win, pos=[0.5,0], units='norm')

You probably used default units of 'norm' and the text rendered 50 screen-widths to the right!

Upvotes: 5

Related Questions