
WaitRelease ( bool ( default True )) – If True then we won’t report any “incomplete” keypress but all KeyList ( list (or other iterable )) – The keys that you want to listen out for. getKeys ( keyList = None, waitRelease = True, clear = True ) ¶ Parameters : WaitForStart ( bool ( default False )) – Normally we’ll start polling the Keyboard at all times but youĬould choose not to do that and start/stop manually instead byĬlearEvents ( eventType = None ) ¶Ĭlear the events from the Keyboard such as previous key presses classmethod getBackend ( ) ¶ Or -1 for all devices acting as a unified KeyboardīufferSize ( int) – How many keys to store in the buffer (before dropping older ones) Or a dict containing the device info (as from getKeyboards()) The Keyboard class provides access to the Psychtoolbox KbQueue-basedĬalls on Python3 64-bit with fall-back to event.getKeys on legacyĬreate the device (default keyboard or select one) Parameters :ĭevice ( int or dict) – On Linux/Mac this can be a device index Keyboard ( device = -1, bufferSize = 10000, waitForStart = False, clock = None, backend = None ) ¶ duration ) Classes and functions ¶ class. getKeys (, waitRelease = True ) if 'quit' in keys : core. reset () # when you want to start the timer from keys = kb. This library makes use, where possible of the same low-level asynchronousįrom psychopy.hardware import keyboard from psychopy import core kb = keyboard. On Linux and Mac you can also distinguish between different keyboard devices We also detect the KeyUp events and therefore provide the option of returning Waiting for the operating system to poll and interpret those same packets

The polling is direct to the USB HID library in C, which is faster than So that times relate to when the key was pressed, not when the call was made The polling is performed and timestamped asynchronously with the main thread
#PSYCHOPY KEY GET 32 BIT#
On 32 bit installations and Python2 it reverts to the older
#PSYCHOPY KEY GET 64 BITS#
On 64 bits Python3 installations it provides access to theįunctions using the same compiled C code (available in python-psychtoolbox lib). The Keyboard class was new in PsychoPy 3.1 and replaces the olderĮvent.getKeys() calls. To handle input from keyboard (supersedes event.getKeys)
