# ratingScale bug: early keypresses registered as "response key", not also as "accept key"

**URL:** https://discourse.psychopy.org/t/ratingscale-bug-early-keypresses-registered-as-response-key-not-also-as-accept-key/1225
**Category:** Builder
**Created:** [October 5, 2016, 6:48pm UTC](https://discourse.psychopy.org/t/ratingscale-bug-early-keypresses-registered-as-response-key-not-also-as-accept-key/1225 "2016-10-05T18:48:04Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![tudor](https://avatars.discourse-cdn.com/v4/letter/t/13edae/32.png) [@tudor](https://discourse.psychopy.org/u/tudor)
#### Post date: [October 5, 2016, 6:48pm UTC](https://discourse.psychopy.org/t/ratingscale-bug-early-keypresses-registered-as-response-key-not-also-as-accept-key/1225/1 "2016-10-05T18:48:05Z")

</div>

Trials in my script end with the subject making a rating, for which I am using a ratingscale component. I wish to have the response keys (1 through 5) also act as “Enter”, so that pressing one of these keys makes the component accept the response without the need for “Enter” to be pressed. I’ve therefore added these keys to the acceptKeys list, in the component’s customisation code.

There is, however, a bug in how the ratingscale component handles early responses. If a key is pressed very soon (\<1s) after the component starts, the key is registered as a response but not also as a key that is meant to end the component. Only if that key (or another) is pressed again does the component take it as an “accept” key.

The same bug occurs if the key is pressed even earlier than the onset of the rating scale screen. To prevent the “bleeding”, @Daniel suggested [this](http://discourse.psychopy.org/t/cannot-assign-fixed-independent-of-rt-duration-to-rating-scale-component/1100/16?u=tudor) workaround, which works fine to prevent “very early” (i.e. before the ratingscale appears on the screen) responses, but does nothing to prevent the behaviour described above, which concerns “early” responses (i.e. keys pressed immediately after the onset of the rating scale on the screen).

I’ve created from scratch a very basic example (an MWE) of a script where this bug is reliably reproducible. It’s [here](http://www.2shared.com/file/5C9RQhQ5/ratingScale_bug.html), in case any of the developers with an interest in ratingScale (Jeremy?) has a chance to have a look. Until a fix is released, a suggestion for a hack/workaround to prevent this behaviour would be much appreciated.

---

<div class="post-metadata">

### Author: ![jeremygray](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jeremygray/32/13_2.png) [@jeremygray](https://discourse.psychopy.org/u/jeremygray)
#### Post date: [October 5, 2016, 9:25pm UTC](https://discourse.psychopy.org/t/ratingscale-bug-early-keypresses-registered-as-response-key-not-also-as-accept-key/1225/2 "2016-10-05T21:25:42Z")

</div>

You should use the singleClick option.

---

<div class="post-metadata">

### Author: ![tudor](https://avatars.discourse-cdn.com/v4/letter/t/13edae/32.png) [@tudor](https://discourse.psychopy.org/u/tudor)
#### Post date: [October 5, 2016, 9:53pm UTC](https://discourse.psychopy.org/t/ratingscale-bug-early-keypresses-registered-as-response-key-not-also-as-accept-key/1225/3 "2016-10-05T21:53:01Z")

</div>

I did, but it didn’t help…

---

<div class="post-metadata">

### Author: ![tudor](https://avatars.discourse-cdn.com/v4/letter/t/13edae/32.png) [@tudor](https://discourse.psychopy.org/u/tudor)
#### Post date: [October 6, 2016, 4:24pm UTC](https://discourse.psychopy.org/t/ratingscale-bug-early-keypresses-registered-as-response-key-not-also-as-accept-key/1225/4 "2016-10-06T16:24:19Z")

</div>

Just to clarify: the responses here are given using keys, not mouse clicks. The singleClick option should therefore be irrelevant, but after checking it anyway, the problem (bug?) remains. Is there anything else I can try?

---

<div class="post-metadata">

### Author: ![jeremygray](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jeremygray/32/13_2.png) [@jeremygray](https://discourse.psychopy.org/u/jeremygray)
#### Post date: [October 8, 2016, 6:55pm UTC](https://discourse.psychopy.org/t/ratingscale-bug-early-keypresses-registered-as-response-key-not-also-as-accept-key/1225/5 "2016-10-08T18:55:02Z")

</div>

The name singleClick is not so good, it DOES apply to keypresses as well. I think you also need to have no minimum time:

```auto
respKeys=['1','2','3','4','5'],
#acceptKeys=['1','2','3','4','5'], 
singleClick=True,
minTime=0,

```

You’ll need the `event.clearEvents()` call if you don’t want keypresses made during the “get read” phase.

---

<div class="post-metadata">

### Author: ![tudor](https://avatars.discourse-cdn.com/v4/letter/t/13edae/32.png) [@tudor](https://discourse.psychopy.org/u/tudor)
#### Post date: [October 9, 2016, 1:13pm UTC](https://discourse.psychopy.org/t/ratingscale-bug-early-keypresses-registered-as-response-key-not-also-as-accept-key/1225/6 "2016-10-09T13:13:33Z")

</div>

Many thanks Jeremy. The minTime=0 line solved my problem.
