Slider
¶Slider (win[, ticks, labels, pos, size, …]) |
A class for obtaining ratings, e.g., on a 1-to-7 or categorical scale. |
Slider.getRating () |
Get the current value of rating (or None if no response yet) |
Slider.getRT () |
Get the RT for most recent rating (or None if no response yet) |
Slider.markerPos |
The position on the scale where the marker should be. |
Slider.setReadOnly ([value, log]) |
When the rating scale is read only no responses can be made and the scale contrast is reduced |
Slider.contrast |
Set all elements of the Slider (labels, ticks, line) to a contrast |
Slider.style |
Sets some predefined styles or use these to create your own. |
Slider.getHistory () |
Return a list of the subject’s history as (rating, time) tuples. |
Slider.getMouseResponses () |
Instructs the rating scale to check for valid mouse responses. |
Slider.reset () |
Resets the slider to its starting state (so that it can be restarted on each trial with a new stimulus) |
psychopy.visual.
Slider
(win, ticks=(1, 2, 3, 4, 5), labels=None, pos=None, size=None, units=None, flip=False, style='rating', granularity=0, readOnly=False, color='LightGray', font='Helvetica Bold', depth=0, name=None, labelHeight=None, autoDraw=False, autoLog=True)¶A class for obtaining ratings, e.g., on a 1-to-7 or categorical scale.
A simpler alternative to RatingScale, to be customised with code rather than with arguments.
A RatingScale instance is a re-usable visual object having a draw()
method, with customizable appearance and response options. draw()
displays the rating scale, handles the subject’s mouse or key responses,
and updates the display. When the subject accepts a selection,
.noResponse
goes False
(i.e., there is a response).
You can call the getRating()
method anytime to get a rating,
getRT()
to get the decision time, or getHistory()
to obtain
the entire set of (rating, RT) pairs.
For other examples see Coder Demos -> stimuli -> slider.py.
Authors: |
|
---|---|
Parameters: |
|
_granularRating
(rating)¶Handle granularity for the rating
_setLabelLocs
()¶Calculates the locations of the line, tickLines and labels from the rating info
_setTickLocs
()¶Calculates the locations of the line, tickLines and labels from the rating info
color
¶Color of the line/ticks/labels according to the color space.
contrast
¶Set all elements of the Slider (labels, ticks, line) to a contrast
Parameters: | contrast – |
---|
draw
()¶Draw the Slider, with all its constituent elements on this frame
getHistory
()¶Return a list of the subject’s history as (rating, time) tuples.
The history can be retrieved at any time, allowing for continuous ratings to be obtained in real-time. Both numerical and categorical choices are stored automatically in the history.
getMouseResponses
()¶Instructs the rating scale to check for valid mouse responses.
This is usually done during the draw() method but can be done by the user as well at any point in time. The rating will be returned but will ALSO automatically be set as the current rating response.
While the mouse button is down we will alter self.markerPos but don’t set a value for self.rating until button comes up
Returns: | |
---|---|
Return type: | A rating value or None |
getRT
()¶Get the RT for most recent rating (or None if no response yet)
getRating
()¶Get the current value of rating (or None if no response yet)
horiz
¶(readonly) determines from self.size whether the scale is horizontal
knownStyles
= ['slider', 'rating', 'radio', 'labels45', 'whiteOnBlack', 'triangleMarker']¶markerPos
¶The position on the scale where the marker should be. Note that this does not alter the value of the reported rating, only its visible display. Also note that this position is in scale units, not in coordinates
rating
¶The most recent rating from the participant or None. Note that the position of the marker can be set using current without looking like a change in the marker position
recordRating
(rating, rt=None, log=None)¶Sets the current rating value
reset
()¶Resets the slider to its starting state (so that it can be restarted on each trial with a new stimulus)
setReadOnly
(value=True, log=None)¶When the rating scale is read only no responses can be made and the scale contrast is reduced
Parameters: |
---|
size
¶The size for the scale defines the area taken up by the line and the ticks.
style
¶Sets some predefined styles or use these to create your own.
If you fancy creating and including your own styles that would be great!
Parameters: | style (list of strings) – Known styles currently include:
Styles can be combined in a list e.g. [‘whiteOnBlack’,’labels45’] |
---|