expyriment.io.StreamingButtonBox

class expyriment.io.StreamingButtonBox(interface, baseline)

A class implementing a streaming button box input.

Methods

__init__(interface, baseline)

Create a streaming button box input.

Parameters :

interface : io.SerialPort or io.ParallelPort

an interface object

baseline : int

code that is sent when nothing is pressed (int)

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.SerialPort

Next topic

expyriment.io.TextInput

This Page