psychopy.org | Reference | Downloads | Github

Bug in Slider Orientation "set every repeat"

URL of experiment: SliderTest [PsychoPy]

Description of the problem:

When setting the size parameter of a Slider component in Builder, referring to variables from a code component, the slider breaks when the parameter is “set every repeat”.

In JS / online: the orientation is not set properly, a slider which should be horizontal, is displayed vertical
In Python / offline: the experiment closes with the error

raceback (most recent call last):
  File "J:\departments\FSW\FAC\SOLO\Lab-support\001 Opdrachten\lopende projecten Kerwin\20210621_PED_Carline_Heijningen_GraphDigitize\SliderTest\SliderTest_lastrun.py", line 93, in <module>
    flip=False, depth=-1, readOnly=False)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\contrib\lazy_import.py", line 120, in __call__
    return obj(*args, **kwargs)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\slider.py", line 191, in __init__
    self._createElements()
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\slider.py", line 304, in _createElements
    self._setTickLocs()
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\slider.py", line 437, in _setTickLocs
    self.tickLocs = self._ratingToPos(self.ticks)
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\slider.py", line 404, in _ratingToPos
    if self.horiz:
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\visual\slider.py", line 231, in horiz
    return self.size[0] > self.size[1]
TypeError: 'float' object is not subscriptable

Setting the size parameter to “constant” fixes the problem for both.

Hi There,

I see this experiment was created in 2021.1.4 - could I please check if this is still the case in 2021.2.2 ? I am aware some bugs were fixed for slider!

Thanks!
Becca