sagerest.blogg.se

Psychopy alignhoriz
Psychopy alignhoriz









  1. #Psychopy alignhoriz update#
  2. #Psychopy alignhoriz code#

I can add the same number of spaces as characters in the question, as you suggested, and by specifying a y ‘pos’ value that pushes some of the leading spaces off the left edge of the screen I can make sure that the text starts as close as I want to this edge. This allows me to left-align several single line questions (each a separate TextStim) that are arranged one below the other on the screen, provided that I use a monospace font (Arial sometimes seem to work out too, maybe the mix of letter sizes tends to even out). It makes centred text look left-aligned, e.g.:īefore adding spaces (ignore the *s, they’re just there to suppress this page’s auto formatting of my text): *abcdeĪfter adding spaces (represented here by ‘-’ characters): *-abcde However, your second suggestion, of adding spaces before the text, is a good enough workaround. With multiple lines of text, the first line is centered on the screen and the subsequent lines are left-aligned with reference to the first line. Your first suggestion, of adding a blank line after my single line of text to fool the tAlignHoriz() function into left-aligning both lines, did not work. Thanks for those helpful suggestions! The second one worked.

#Psychopy alignhoriz code#

But I would prefer to stick with v3.2.4 unless there is some way to turn off the autoJS function, as I have found this is not very effective at generating JS code (I’ve found there are some quite significant differences in the code structure of the Python and JS commands, as well as in the appearance of the displays they produce), and sometimes JS code I have written seems to disappear (although this might be my imagination!).

#Psychopy alignhoriz update#

In PsychoPy v2020.1, the default value of the alignHoriz property appears to be ‘left’, rather than ‘center’, so in principle I could just update to PsychoPy v2020.1. Also, this is a messy approach, given the structure of a Builder program. Is there any way to change the alignHoriz property of a TextStim component after it has been created? Must I instead create the TextStim component in the code component and set its initial alignHoriz property there? I’ve made some attempt to do this, but was unable to get the TextStim component to display at all. In my Python code, exactly the same command in exactly the same location in program is effective in left-aligning the TextStim component. the value of TextStim.alignHoriz is changed but the position of the TextStim component is not. I have tried using an alternative command (TextStim.alignHoriz = ‘left’), but with the same result, i.e. I have tried moving the tAlignHoriz(‘left’) command into the ‘Each Frame’ tab of the Code component, but it doesn’t work here either. in the same location as the tAlignHoriz(‘left’) command) is able to modify the TextStim component. In contrast, tText() command in the Begin Routine tab of this Code component (i.e. However, it has no effect on the position of the TextStim component: this remains centred. It changes the value of TextStim.alignHoriz from ‘center’ (the default value) to ‘left’.

psychopy alignhoriz psychopy alignhoriz

I have put the tAlignHoriz(‘left’) command in the Begin Routine tab of a Code component.

psychopy alignhoriz

I want to left-align the TextStim.Īccording to the PsychoJS documentation, the tAlignHoriz() function should do this. For each question, the TextStim is on the left and the Slider is on the right. I’m using TextStim and Slider components to show survey questions with an appearance similar to the Form component, since this component does not work in Pavlovia. I’m using PsychoPy v3.2.4 and writing a Builder program to run on Pavlovia.











Psychopy alignhoriz