Skip to content

Commit e33f733

Browse files
committed
BF: Return keys if maxWait <= 0
1 parent 4ffc99e commit e33f733

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

psychopy/iohub/client/keyboard.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def waitForKeys(self, maxWait=None, keys=None, chars=None, mods=None,
394394
Returned events are sorted by time.
395395
396396
:param maxWait: Maximum seconds method waits for >=1 matching event.
397-
If 0.0, method functions the same as getKeys().
397+
If <=0.0, method functions the same as getKeys().
398398
If None, the methods blocks indefinitely.
399399
:param keys: Include events where .key in keys.
400400
:param chars: Include events where .char in chars.
@@ -427,6 +427,11 @@ def pumpKeys():
427427
win32MessagePump()
428428
return key
429429

430+
# Don't wait if maxWait is <= 0
431+
if maxWait <= 0:
432+
key = pumpKeys()
433+
return key
434+
430435
while getTime() < (timeout - checkInterval * 2):
431436
# Pump events on pyglet windows if they exist
432437
ltime = getTime()

0 commit comments

Comments
 (0)