'TextBox2' object has no attribute 'setBorderWidth'

Hi all,

I’m trying to change the textbox border width on each repeat

But I got the following error:

Generating PsychoPy script...

I don't know the appropriate default value for a 'borderWidth' parameter. Please email the mailing list about this error
I don't know the appropriate default value for a 'borderWidth' parameter. Please email the mailing list about this error
## Running: C:\Users\LTS\Documents\psy\Selectivity_Grid_ENG\Selectivity_grid_ENG_lastrun.py ##
2030.8145     INFO     Loaded monitor calibration from ['2022_08_05 22:48']
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Traceback (most recent call last):
Hello from the pygame community. https://www.pygame.org/contribute.html
2.5204     WARNING     We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['sounddevice', 'PTB', 'pyo', 'pygame'] (in that order).
  File "C:\Users\LTS\Documents\psy\Selectivity_Grid_ENG\Selectivity_grid_ENG_lastrun.py", line 2871, in <module>
AttributeError: 'TextBox2' object has no attribute 'setBorderWidth'
################ Experiment ended with exit code 1 [pid:19404] #################
2052.9281     INFO     Loaded monitor calibration from ['2022_08_05 22:48']

But I tried to set Text Color on each repeat with “$color”, the program can change its color. Do we not have the function to customize the border width on every repeat?

I also checked the documentation of TextBox2, it doesn’t seem to have this function.

My PsychoPy Builder version v2022.2.3

Thanks in advance!

Hi, sorry to hear you have been experiencing this error. I’ve managed to replicate it on my end and have flagged this to the developers.

In the meantime, a workaround would be to use a polygon component and place it behind the textbox component and changing its size (see minimal demo). Hope this helps :slight_smile:
fake_border.psyexp (13.7 KB)
cond.xlsx (8.4 KB)

Thank you for the help, I’ll give it a try!

Hi, thank you again for your solution.

But I have another problem now. I need to change the color of the border (the fill color of the rectangle). I used a variable for this purpose and change it in the code component.

The problem is after I made these changes, the experiment always shows the rectangle above the textbox, so it basically covers the textbox, despite that I put the rectangle above the textbox in the builder, which means the experiment should draw the rectangle first and then the textbox on top of the rectangle.

Interestingly, it actually works on pavlovia, the rectangle shows behind the textbox.

I implemented these in your mini-demo. I’d really appreciate it if you could provide any insights!

Thanks in advance.
fake_border.psyexp (15.1 KB)
cond.xlsx (8.4 KB)

And I also have another issue about the button position.

According to our documentation, I used height as spatial units as recommended, and the range should be (-0.6667,-0.5) in the bottom left to (+0.6667,+0.5) in the top right. In my experiment, I want the button to be at the bottom right corner. As seen below:

And to achieve this for the online experiment, I have to specify the position as (0.66, -0.88).
As a result, I couldn’t see the button in the Python version. And also you can see here that the rectangle covers the textbox.

If I specify it as (0.66, -0.44),
then in the python version I can see the button. But the word “Next” is missing.

But then in the online version, it is not exactly at the bottom.

Again, thank you for any insights!

Hi there,

With regards to the polygon showing up in front of the textbox locally - I’m using PsychoPy 2023.1.3 and the polygon is appearing behind the textbox. If you’re using an older version, I’d recommend updating to this version.

And with the Next button, is your screen using height units? You can check in Experiment Settings > Screen > Units