Hello,
I only work with coder but starting from this code might help you (see also attachments):
valencePic = "SAM valence.jpg" #or whatever the path and filename
arousalPic = "SAM arousal.jpg" #or whatever the path and filename
dimensions = ('valence', 'arousal')
displacement = 8
window = visual.Window(fullscr=True, color='black', allowGUI=False, monitor='Default', units='cm') #Creates the window object. A monitor setup called "Default" with the physical dimensions of your monitor are needed in the monitor center (the icon with 2 monitors)
text = visual.TextStim(win=window, ori=0, name='Text', font='Arial', units=u'pix', pos=[0, 0], height=24, wrapWidth=None, color='white', colorSpace='rgb', opacity=1, depth=0.0)
ratingPic = visual.ImageStim(window, pos=[0,-displacement]) #suitable values for pos my vary according to screen size and resolution
ratingScale = visual.RatingScale(window, low=0, high=4, pos=[0, -displacement/8.0], stretch=2.5, showValue=False, scale="", labels=("", ""), acceptPreText='(choose)', acceptText='OK', mouseOnly=True) #suitable values for pos and stretch my vary according to screen size and resolution
image = visual.ImageStim(window, pos=[0,displacement]) #suitable values for pos my vary according to screen size and resolution
text = visual.TextStim(window, height=1.5, pos=[0,displacement])
def samRating(stimulus, dimension):
event.Mouse(visible=True)
ratingScale.reset()
while ratingScale.noResponse:
if event.getKeys(["escape"]): core.quit() #easy quitting while testing
#set stimulus, i.e. pic or question
if os.path.exists(stimulus) and not os.path.isdir(stimulus): image.setImage(stimulus); image.draw(window)
else: text.setText(stimulus); text.draw(window)
#set sam pic (valence or arousal)
if dimension == dimensions[0]:
samPic.setImage(valencePic)
else:
samPic.setImage(arousalPic)
ratingPic.draw()
ratingScale.draw()
window.flip()
return ratingScale.getRating())
Whenever you call the samRating function, you have to pass it a stimulus, i.e. either a valid pathname of a picture to be rated or a question (e.g. "How would you describe your current mood?") and which dimension you want to rate (i.e. 'valence' or 'arousal' or you can alternatively insert dimensions[0] or dimension[1] resp.). It then should operate as you need.
Note, however, that participants have to click on the scale
below the SAM-picture and should be instructed to do so.
I also attached a picture (different background color).
Best wishes
Mario