TextBox: specified height size works locally, but isn't translated to pavlovia

git: textBox 2020.2.4


Description of the problem: I’m testing out the new TextBox to use online for free response collection (editable). Two aspects aren’t working on pavlovia:

  1. The edited response text is not saved in the output file-- looks like this is already being addressed here so hopefully that’ll work soon!
  2. The textbox size specified via gui is not reflected when running online. I just have “Type here” and then a larger specified size so that the ptp can type a lot and see the text wrap around (rather than be one long line).
    Width works (I change width via gui, the change is reflected in pav), but however I change the height. it remains the size of one line of text.
    I tried adding a 2 additional lines of text to the textbox (to see if that’d force it to increase height), but the height on pavlovia is still the size of one text line, and appears to be centered on the middle line (see below).

This is surprising given the textBox chunk in the textBox.js file:

function experimentInit() {
  // Initialize components for Routine "textBox"
  textBoxClock = new util.Clock();
  text = new visual.TextStim({
    win: psychoJS.window,
    name: 'text',
    text: "What strategies did you use to help you learn the pairs?\n\nPlease fill out the text box below, and press the 'right' arrow key to proceed once you've finished your response.",
    font: 'Arial',
    units: undefined, 
    pos: [0, 0.2], height: 0.04,  wrapWidth: undefined, ori: 0,
    color: new util.Color([(- 1.0), (- 0.498), (- 0.498)]),  opacity: 1,
    depth: 0.0 
  TextBox = new visual.TextBox({
    win: psychoJS.window,
    name: 'TextBox',
    text: 'Type here\napples and oranges\ncars',
    font: 'Arial',
    pos: [(- 0.35), 0], letterHeight: 0.03,
    size: [0.7, 0.4],  units: undefined, 
    color: [(- 1.0), (- 1.0), (- 1.0)], colorSpace: 'rgb',
    fillColor: [0.506, 0.506, 0.506], borderColor: [(- 1.0), (- 1.0), (- 1.0)],
    bold: false, italic: false,
    opacity: 1,
    padding: 0.015,
    editable: true,
    anchor: 'top-left',
    depth: -1.0 

How best to specify textBox height size for pavlovia?

Hey @sawal, many thanks for flagging, your report is extremely helpful. I have now raised the issue on GitHub and should be coming up with a fix before too long. Thank you, s.

1 Like

Hi @sotiri, it looks like this issue is closed on Github now, but I just downloaded 2020.2.5 and am having the same issue where the textbox height on pavlovia doesn’t reflect what’s set-up in Builder.

Is this still in progress?

Hi @sawal, sorry about this, a fix is still pending I’m afraid. Closed is a duplicate issue (No. 182) referenced alongside it. Thanks again for your patience while we look for a solution :blush:

Hi @sotiri, thanks for letting me know. Might you have a sense on timing? This is the last part of an experiment I’ve been developing for quite awhile that I really hoped to get live ASAP. Any code components I can add as a temp fix? Thanks for your response!

Hi @sawal, I understand totally, first thing Monday I’ll be taking another look, hope that’s OK, x

1 Like

Thank you, @sotiri!

Hey @sawal, while a permanent fix is on the way, please could you give me developer access so that I can patch PsychoJS in place for you, thanks, x

@sotiri done, thank you!

1 Like

Hi @sotiri, any updates on this? Thank you again for helping me with a temp fix!

No worries @sawal, as soon as the relevant PR is merged I will be making sure to follow up here to let you know, thanks for your patience, x

1 Like

Hi @sawal, OK PsychoJS latest now has TextBox multiline added in and you should be good to remove ‘custom-lib’ from your project. Thanks again for your help in debugging our code, x

Hi @sotiri, thanks for the update! Does this mean that on the most up-to-date psychopy v2020.2.10, textbox height should be able to be changed via gui and it should be reflected in js (and work on pavlovia)?


Hi @sawal, almost! There is still some work left on our end to observe the height setting in PsychoPy. For now, you can edit your main script to make a given TextBox instance multiline as shown below, but again no ‘custom-lib’ required FWIW, x

multiline = new visual.TextBox({
  // ...
  multiline: true,

This code was super helpful, can confirm it worked for me as well in allowing multiple lines when inserted into the code. However, I was unable to change the height of the textbox, is there a specific place in the code to do this? Thanks!

Hi @PSYresearcher, a multiline TextBox is required for the size attribute to reflect as expected in the vertical dimension. The demo below should give you the details. Please let me know if you need more support, x

1 Like

Ah I forgot to make the appropriate changes in the builder, this worked perfectly. Thanks!

hi @sotiri i am also facing the same issue and not sure where exactly to put this code .
i use 2020.2.10 version and develop everything using the builder but run my experiment online.
my text box size is not changing in pavlovia.
when i added this line of code in the begin routine tab in the code code component an error appeared * TypeError: Cannot read property ‘_psychoJS’ of undefined
and when i added to " multiline = true," line in the JS main code
it keeps erasing itself every time i sync my builder tp pavlovia

Hi @chayabenyehuda, no problem, would it be possible to give me developer access to your project via GitLab? Discourse seems to be obscuring links to private repositories. Thanks, x

thank you! access given.
i would love to know what you did since i have 2 more projects with the same need :slight_smile: