expyriment.io.EventButtonBox

class expyriment.io.EventButtonBox(interface)

A class implementing an event button box input.

Methods

__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 incomming interface event.

Parameters :

interface : io.SerialPort or io.ParallelPort

an interface object

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 :

codes : int 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_comparison : bool, optional

make a bitwise comparison (default=False)

Returns :

key : int

key code or None

clear()

Clear the receive buffer (if available).

interface

Getter for interface.

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

Wait for responses defined as codes.

Parameters :

codes : int 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

duration : int, optional

maximal time to wait in ms

no_clear_buffer : bool, optional

do not clear the buffer (default = False)

bitwise_comparison : bool, optional

make a bitwise comparison (default = False)

check_for_control_keys : bool, optional

checks if control key has been pressed (default=True)

Returns :

key : int

key code (or None) that quitted waiting

rt : int

reaction time

Notes

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

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

Previous topic

expyriment.io.DataFile

Next topic

expyriment.io.EventFile

This Page