WARNING: Keyboard buffer

macOS Mojave 10.14.5
PsychoPy version: v3.1.2
Standard Standalone? (y/n): Yes
Builder view

Hi all,

I created an experiment on the Builder view. It has two parts: One is silent, the other is Music part. I work with babies so I need to record babies looking behaviour during the experiment.

So, I also added the keyboard code (someone suggested on the forum):

from psychopy.hardware import keyboard
from psychopy import core
kb = keyboard.Keyboard()
# during your trial
kb.clock.reset()  # when you want to start the timer from
keys = kb.getKeys(['right', 'left', 'quit'])
kb.start()
if 'quit' in keys:
    core.quit()
kb.stop()
for key in keys:
    print(key.name, key.rt, key.duration)

Everything was good until the second part. There is a WARNING sign says:
78.7266 WARNING Stopping key buffers but this could be dangerous ifother keyboards rely on the same.

Could anyone say me what does it mean, please? Do you think I have same technical issue in my computer rather than the PsychoPy.

Thank you.
Best,
Zehra

Hi Zehra,

I’m not too familiar with the new keyboard system introduced in version 3.1, but I don’t think you need the kb.stop() line here.

It’s also not clear when you have this code running. i.e. in a Builder code component, some of this code should run at the start of the experiment, some at one point during the routine, and some on every screen refresh.

Is there a reason why you can’t just use the graphical keyboard component in Builder? It should handle all of this for you automatically. You just need to specify what you want inside the keyboard dialog box (e.g. the list of accepted keys, that a keypress ends the routine, and so on).

Dear Michael,

Many thanks for your suggestion!
It worked and there is no sign of warning. However, the second part is still not working.

The reason why I cannot use the graphical keyboard component in Builder is that we should record the duration of babies looking (I need to press the key several times). The keyboard record to the total amount of the time. I need to get intervals.

My supervisor said something like logging that I cannot do it with Builder. He says when we record looking behaviour, we should key press several times because babies looking is unstable (I mean they look away a lot. During this time I should stop the recording until the baby looking at the stimuli).

I hope I could explain my problem to you. Do you think I could do ‘logging’ with the graphical keyboard component in Builder?

Thank you very much for your time helping people.
Best,
Zehra