expyriment.io.StreamingButtonBox

class expyriment.io.StreamingButtonBox(interface, baseline)

A class implementing a streaming button box input.

__init__(interface, baseline)

Create a streaming button box input.

Parameters:
interfaceexpyriment.io.SerialPort or expyriment.io.ParallelPort

the interface to use

baselineint

code that is sent when nothing is pressed (int)

property baseline

Getter for baseline.

check(codes=None, bitwise_comparison=False)

Check for response codes.

If bitwise_comparison = True, the function performs a bitwise comparison (logical and) between codes and received input.

Parameters:
codesint or list, optional

certain bit pattern or list of bit pattern to wait for, if codes is not set (None) the function returns for any event that differs from the baseline

bitwise_comparisonbool, optional

make a bitwise comparison (default=False)

Returns:
keyint

key code or None

clear()

Clear the receive buffer (if available).

property interface

Getter for interface.

property logging

Getter for logging.

set_logging(onoff)

Set logging of this object on or off

Parameters:
onoffbool

set logging on (True) or off (False)

wait(codes=None, duration=None, no_clear_buffer=False, bitwise_comparison=False, callback_function=None, process_control_events=True)

Wait for responses defined as codes.

If bitwise_comparison = True, the function performs a bitwise comparison (logical and) between codes and received input and waits until a certain bit pattern is set.

Parameters:
codesint or list, optional

bit pattern to wait for if codes is not set (None) the function returns for any event that differs from the baseline

durationint, optional

maximal time to wait in ms

no_clear_bufferbool, optional

do not clear the buffer (default = False)

bitwise_comparisonbool, optional

make a bitwise comparison (default = False)

callback_functionfunction, optional

function to repeatedly execute during waiting loop

process_control_eventsbool, optional

process io.Keyboard.process_control_keys() and io.Mouse.process_quit_event() (default = True)

Returns:
keyint

key code (or None) that quited waiting

rtint

reaction time

Notes

This will also by default process control events (quit and pause). Thus, keyboard events will be cleared from the cue and cannot be received by a Keyboard().check() anymore!