Adding a Rating Scale GUI

There are examples in the ExampleScripts folder under "RatingScale_GUI" to see how to have the rating available. You can use different yield statements to trigger the rating GUI to show up.

Add this line to show a rating:

yield sightlab.showRatings('What Is Your Answer?')

Can set Choice Text and adjust options, such as pausing the timer

yield sightlab.showRatings('What Is Your Answer?', ratingScale = ["Yes", "No", "Unsure"], pauseTimer = True)

import sightlab_utils.sightlab as sl

from sightlab_utils.settings import *  


sightlab = sl.SightLab()


scaleList = ["Yes", "No", "Unsure"]


def sightLabExperiment():

while True:

yield viztask.waitKeyDown(' ')

yield sightlab.startTrial()

yield viztask.waitKeyDown(' ')

yield sightlab.showRatings('What Is Your Answer?', ratingScale = scaleList, pauseTimer = True)

yield sightlab.endTrial()

viztask.schedule(sightlab.runExperiment)

viztask.schedule(sightLabExperiment)


For getting access to the rating value you can use this code:

chosen_rating = sightlab.ratingChoice


And for something to change based on the rating value:

if chosen_rating >= 8:  

  print("Rating too high.")


There are many options available to trigger an event. Here are just a few examples: 

When you run the experiment now the rating will show up after the specified trigger. Use the right hand trigger to proceed and the left and right trackpad or thumbstick to choose the answers. For the desktop use the left mouse button and arrow keys. 

The chosen values will also be saved in the trial_data.csv file

Attributes:

Can set ratingScale to be any string

scaleList = ["Yes", "No", "Unsure"]


showRatings(message, ratingScale = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'], color = viz.WHITE, characterLimit = 8, pauseTimer = False)


yield sightlab.showRatings('What Is Your Answer?', ratingScale = scaleList, pauseTimer = True)

There is also the option for a startRating or endRating (note: If using this method with the GUI it is best to set the Start and End conditions to 'None' and use code to set the start and end conditions). 

yield sightlab.endTrial( endRatings = {'message': 'Which One Do You Prefer?', 'ratingScale': ["Left","Right"]})