expyriment.io.EventButtonBox

class expyriment.io.EventButtonBox(interface)

A class implementing an event button box input.

__init__(interface)

Create an event button box input.

Compared to a StreamingButtonBox, an EventButtonBox has no baseline (baseline=None). The methods wait() and check() are therefore responsive to every incoming interface event.

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

the interface to use

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!