psychopy.org | Reference | Downloads | Github

Textbox2 v2020.2.5 & 2020.2.6: Various errors in Runner- textBox2 'norm' vs 'height' units

Hi there, I just downloaded v2020.2.5 and tried to run an experiment that ran fine (locally & online) in v2020.2.4 that has one beta Textbox and many sliders.

When I first tried to run it, I could get to the Participant ID but afterwards psychopy crashed and left some notes for me in runner. I tried a few times, closed & re-opened, restarted computer, and magically the errors went away as they sometimes do (and the exp ran fine locally & online in v2020.2.5).

This morning I re-opened the exp (no changes) and tried to run again, and the errors are back in action. Tried restarting etc., but the errors persist:

Traceback (most recent call last):
File “C:\Users\Samantha\Box Sync\Psychopy\TIQuest_v1\TI_questionnaires_lastrun.py”, line 121, in
autoLog=True,
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\textbox2\textbox2.py”, line 160, in init
self.font = font
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\tools\attributetools.py”, line 32, in set
newValue = self.func(obj, value)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\textbox2\textbox2.py”, line 241, in font
size=int(round(self._pixLetterHeight)),
TypeError: type numpy.ndarray doesn’t define round method

Experiment ended.

These seem like basic properties that I’m not changing?
The first error (within my exp. code): autoLog=True for textbox2. I can’t seem to find documentation autoLog for textbox2.

The remaining errors refer to the installation program files (e.g. attributetools.py, tetbox2.py), not my experiment code. Does this look like a warped installation (and I should just uninstall, re-install), or is this a 2020.2.5 issue?

I’ve figured out where the issue seems to be stemming from.

Textbox2 units can’t be “norm” at least in 2020.2.5 & 2020.2.6. There are no errors if the units are ‘height’, but changing the units to ‘norm’ now consistently produces the errors above in Builder runner after entering clicking OK for the participant ID dialogue box. I edited the title of the original post to reflect this.

This can be tested using the attached psyexp and changing units to norm. It also isn’t consistent choosing “latest” as the psychopy version-- click 2020.2.6 instead.

Is there a temp code fix I can include to allow norm units to work in textbox2?

textBox.psyexp (13.0 KB)

The reason this happens is that norm scales things horizontally by a different value than vertically, so when the textbox attempts to calculate font size it doesn’t know (yet) which value to use. If you know the ratio between the width and height of the screen, you can set the units on the textbox to be height and then use a constant to transform any x coordinates. For example, if your screen is 1080x920, you could create a variable whose value is 1080/920 and then multiple the first value of size and pos for your textbox by this variable.