Continuing the discussion from How to fix the problem that parameters from excel exert to the slider's labels?:
The link above is my attempt to do randomization with Excel and Loop. But something went wrong.
For now, I try to use code. However, I still cannot assign the value to sliders’ label.
The code is below, and I put it in the “begin experiment”. The running result is that there is no error report, but there is no value on the sliders.
emotion_grp = [("Warm" , "Cool"),
("Heavy", "Light"),
("Modern", "Classical"),
("Clean", "Dirty"),
("Active", "Passive"),
("Hard", "Soft"),
("Tense", "Relaxed"),
("Fresh", "Stale"),
("Masculine", "Feminine"),
("Like", "Dislike")]
from numpy import random
random.shuffle(emotion_grp)
print(emotion_grp)
slist = [scale1, scale2, scale3, scale4, scale5, scale6, scale7, scale8, scale9, scale10]
for i, label in enumerate(emotion_grp):
slist[i].labels = label
#slist[i]._layout()
slist[i]._needVertexUpdate = True
slist[i].draw()
Any information will be helpful.
ps. If I put the value in the coder page, such as:
scale1.labels = emotion_grp[0]
...
scale2.labels = emotion_grp[1]
The problem will be solved, but I cannot save as a psychopy file.