Skip to content

Commit

Permalink
BF: Return keys if maxWait <= 0
Browse files Browse the repository at this point in the history
  • Loading branch information
ariekahn committed May 11, 2019
1 parent 4ffc99e commit e33f733
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion psychopy/iohub/client/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def waitForKeys(self, maxWait=None, keys=None, chars=None, mods=None,
Returned events are sorted by time.
:param maxWait: Maximum seconds method waits for >=1 matching event.
If 0.0, method functions the same as getKeys().
If <=0.0, method functions the same as getKeys().
If None, the methods blocks indefinitely.
:param keys: Include events where .key in keys.
:param chars: Include events where .char in chars.
Expand Down Expand Up @@ -427,6 +427,11 @@ def pumpKeys():
win32MessagePump()
return key

# Don't wait if maxWait is <= 0
if maxWait <= 0:
key = pumpKeys()
return key

while getTime() < (timeout - checkInterval * 2):
# Pump events on pyglet windows if they exist
ltime = getTime()
Expand Down

0 comments on commit e33f733

Please sign in to comment.