# Choice option in Form response not working properly

NOTE: My original experiment was created in PsychoPy 2020.1.3. I have since saved the file (and added the form component) in PsychoPy 2021.2.0. I have had no issues editing or running my experiment.

I’m attempting to integrate my demographics form at the beginning of my PsychoPy experiment, instead of having to run it separately in a browser. Creating the form has worked fine, but I’m running into 2 problems when I try to run the experiment (both explained and shown in the image below).

Problem 1: I can only select ‘choice’ options at either end of the options. I cannot select any choice in the middle; it selects the choice at the closest end. See image below where my mouse is and which choice option is selected. Questions with only 2 options (i.e., ‘yes’/‘no’ work fine; you can select either choice by clicking on it).

Problem 2: One of my questions has a lot of text for each choice option. The options are showing on top of each other and on top of the question text. Is there any way to change the formatting so this doesn’t happen (e.g., change spacing or make options vertical)?

20.0922 WARNING Form currently only formats correctly using height units. Please change the units in Experiment Settings to ‘height’

My experiment is set to ‘pix’ because that’s what I need for the rest of the experiment. When I run, the form shows up fine (I think), except for the problems noted above. When I changed the experiment units to ‘height’, the form crashed the experiment with a MemoryError. I’m not sure if this is an issue at all, as the form seems to run with no problems when my experiment is set to ‘pix’. Full error below for documentation purposes (note: the form is the first routine of my experiment and there is nothing that shows prior to the form opening):

Any help is appreciated!

• Elisabeth

Traceback (most recent call last):
File “C:\Users\Elisabeth\OneDrive\PhD\Research\Visual Search And Personality\Experiment 3a\MultipleTargets_lastrun.py”, line 187, in
depth=0.0);
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\text.py”, line 226, in init
self.setText(text, log=False)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\text.py”, line 374, in setText
setAttribute(self, ‘text’, text, log)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\tools\attributetools.py”, line 141, in setAttribute
setattr(self, attrib, value)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\tools\attributetools.py”, line 32, in set
newValue = self.func(obj, value)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\text.py”, line 365, in text
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\text.py”, line 391, in _setTextShaders
multiline=True, width=self.wrapWidthPix) # width of the frame
File "C:\Program Files\PsychoPy\lib\site-packages\pyglet\text_init
.py", line 462, in init
‘align’: align,
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\text\document.py”, line 604, in set_style
0, len(self.text), attributes)
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\text\document.py”, line 512, in set_style
self.dispatch_event(‘on_style_text’, start, end, attributes)
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\event.py”, line 418, in dispatch_event
if handler(*args):
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\text\layout.py”, line 1073, in on_style_text
self._init_document()
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\text\layout.py”, line 1043, in _init_document
self._update()
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\text\layout.py”, line 966, in _update
lines = self._get_lines()
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\text\layout.py”, line 942, in _get_lines
glyphs = self._get_glyphs()
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\text\layout.py”, line 1085, in get_glyphs
glyphs.extend(font.get_glyphs(text[start:end]))
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\font\base.py”, line 394, in get_glyphs
self.glyphs[c] = glyph_renderer.render(c)
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\font\win32.py”, line 471, in render
glyph = self.font.create_glyph(image)
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\font\base.py”, line 362, in create_glyph
self.texture_mag_filter)
File "C:\Program Files\PsychoPy\lib\site-packages\pyglet\image_init
.py", line 1549, in create_for_size
blank = (GLubyte * (width * height * 4))()
MemoryError

##### Experiment ended.

The reason options are only being selected at either end is what that units warning is about - essentially, if the experiment units are pix, then positions are sent to the form (which can only be in height) in pix, but the form interprets them in height. So if you click 20px from the centre of the screen, the form thinks you’ve clicked 20 x screen heightpx away. So your first problem and that warning are linked.

Changing the experiment from pix to height probably causes a memory error because there’ll be some stimulus which was previously X pixels tall that is now X screens tall, which will be a lot to load.

This is one of the bugs we want to get fixed as a requirement for removing the “beta” sticker from Form , but in the mean time one solution is to set experiment units to height and then set each of your other components’ units to pix, if that’s possible to do.

Okay, I’ve changed the experiment settings to ‘height’ and the necessary stimuli settings to ‘pix’. I believe this will work, even though I’m running into a couple issues right now (I just have to debug these and they should be good).

I do have 1 more question before I continue down this road however. One of my form questions has a lot of text and currently shows like this (below):

I’ve adjusted both the layout (w,h) and the Item Padding. My other questions are fine, but I can’t seem to get enough space for this one. Any suggestions?

Elisabeth

Text spacing is also one of the things we’re working on before taking the beta sticker off of Form, so there are definitely some rough edges on that one. One option is to add \n to your labels wherever you want a line break, e.g.

Sleep onset\nsoon; having\ndream like\nthoughts