OS (e.g. Win8):
PsychoPy version (3.2.4):
**Standard Standalone? (y):
**What are you trying to achieve?:
Im building a slider task, where participants are supposed to click in the middle (value = 50) of the slider. Since I want the Sliders to be in different positions on the screen, I use a conditions file with the first column “position”, which works perfectly fine, when using $position in the building of the slider.
My Problem is, that participants receive feedback about their mouse click (value 1-100 or invalid click (= “Bitte klicken Sie auf den Slider!”)). Since the valid positions of a click (x, y values) depend on the position of the according slider I use this conditions file with the columns (position, xlow, xhigh, ylow, yhigh, center) and use a piece of code in my feedback routine which looks as follow:
**Begin Routine**
X=trial_mouse_2.getPos() [0]
Y=trial_mouse_2.getPos() [1]
if X >= (trial_loop_2["xlow"]) and X <= (trial_loop_2["xhigh"]) and Y >= (trial_loop_2["ylow"]) and Y <= (trial_loop_2["yhigh"]):
result = (trial_loop_2["center"]) + int(X * 100)
msg = str(result)
else:
msg = "Bitte klicken Sie auf den Slider!"
#I tried different codes, this code I got from an other forum discussion, but not about the exact same Problem I have.
#trial_loop_2 = Name of my loop, looping around the routine (polygon/mouse for slider & text/code for feedback)
**Error Message**
if X >= (trial_loop_2["xlow"]) and X <= (trial_loop_2["xhigh"]) and Y >= (trial_loop_2["ylow"]) and Y <= (trial_loop_2["yhigh"]):
TypeError: 'TrialHandler' object is not subscriptable
So that is the Error Message I get every time. Unfortunately Google and this forum couldn’t help me out, about how the correct code to get the feedback output properly based on the conditions file should look like.
Hope somebody here can help me out. Would really appreciate any help. Thank you.