How to use the psychtoolbox.WaitSecs function in psychtoolbox

To help you get started, we’ve selected a few psychtoolbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kleinerm / Psychtoolbox-3 / PsychPython / demos / hidtest_pythonic.py View on Github external
def run():

    dev = kbDevices[0]
    # KbQueueTest
    ptb.WaitSecs('YieldSecs', 1)
    keyboard = hid.Keyboard(dev['index'])

    # keyboard.queue_create(num_slots=10000)  # done implicitly but can redo

    # keyboard.start_trapping() # stops keys going to stdout but sketchy!

    keyboard.queue_start()
    t0 = ptb.GetSecs()
    while ptb.GetSecs() < t0+5:
        ptb.WaitSecs('YieldSecs', 0.00001)
        if keyboard.flush():
            evt = keyboard.queue_get_event()
            print(evt)
    keyboard.queue_stop()
github kleinerm / Psychtoolbox-3 / PsychPython / demos / hidtest_pythonic.py View on Github external
def run():

    dev = kbDevices[0]
    # KbQueueTest
    ptb.WaitSecs('YieldSecs', 1)
    keyboard = hid.Keyboard(dev['index'])

    # keyboard.queue_create(num_slots=10000)  # done implicitly but can redo

    # keyboard.start_trapping() # stops keys going to stdout but sketchy!

    keyboard.queue_start()
    t0 = ptb.GetSecs()
    while ptb.GetSecs() < t0+5:
        ptb.WaitSecs('YieldSecs', 0.00001)
        if keyboard.flush():
            evt = keyboard.queue_get_event()
            print(evt)
    keyboard.queue_stop()
github psychopy / psychopy / psychopy / hardware / keyboard.py View on Github external
def _flushEvts(self):
        ptb.WaitSecs('YieldSecs', 0.00001)
        while self.dev.flush():
            evt, remaining = self.dev.queue_get_event()
            key = {}
            key['keycode'] = int(evt['Keycode'])
            key['down'] = bool(evt['Pressed'])
            key['time'] = evt['Time']
            self._evts.append(key)