I’m using PsychoPy v3.2.4 and writing a Builder program to run on Pavlovia. 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. For each question, the TextStim is on the left and the Slider is on the right. I want to left-align the TextStim.
According to the PsychoJS documentation, the TextStim.setAlignHoriz() function should do this. I have put the TextStim.setAlignHoriz(‘left’) command in the Begin Routine tab of a Code component. It changes the value of TextStim.alignHoriz from ‘center’ (the default value) to ‘left’. However, it has no effect on the position of the TextStim component: this remains centred. In contrast, TextStim.setText() command in the Begin Routine tab of this Code component (i.e. in the same location as the TextStim.setAlignHoriz(‘left’) command) is able to modify the TextStim component. I have tried moving the TextStim.setAlignHoriz(‘left’) command into the ‘Each Frame’ tab of the Code component, but it doesn’t work here either.
I have tried using an alternative command (TextStim.alignHoriz = ‘left’), but with the same result, i.e. the value of TextStim.alignHoriz is changed but the position of the TextStim component is not. In my Python code, exactly the same command in exactly the same location in program is effective in left-aligning the TextStim component.
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. Also, this is a messy approach, given the structure of a Builder program.
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. 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!).