runtimeInfo=None,
                                 originPath='newioLabsButtonBoxComponent.py',
                                 savePickle=True,
                                 saveWideText=True,
                                 dataFileName=filename)
# save a log file for detail verbose info
logFile = logging.LogFile(filename + '.log', level=logging.EXP)
logging.console.setLevel(
    logging.WARNING)  # this outputs to the screen, not a file

endExpNow = False  # flag for 'escape' or other condition => quit the exp

# Start Code - component code to be run before the window creation
# connect to ioLabs bbox, turn lights off
from psychopy.hardware import iolab
iolab.ButtonBox().standby()

# Setup the Window
win = visual.Window(size=(1024, 768),
                    fullscr=True,
                    screen=0,
                    winType='pyglet',
                    allowGUI=False,
                    allowStencil=False,
                    monitor='testMonitor',
                    color=[0, 0, 0],
                    colorSpace='rgb',
                    blendMode='avg',
                    useFBO=True,
                    units='height')
# store frame rate of monitor if we can measure it
Exemple #2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Demo to illustrate using ioLabs button box.
"""

__author__ = 'Jonathan Roberts (orig demo); Jeremy Gray (rewrite 2013)'

from psychopy.hardware import iolab
import random
from psychopy import core, visual, event

# set up the button box
bbox = iolab.ButtonBox()
buttons = [1, 6]
bbox.setLights(buttons)  # turn on those two lights, others off
bbox.setEnabled(buttons)  # ignore other buttons

# show instructions, wait for spacebar
win = visual.Window()
instructions = visual.TextStim(
    win,
    wrapWidth=1.8,
    height=.08,
    text='6 trials:\nhit the left lighted button when you see the word "left".\n'
    'hit the right lighted button when you see the word "right".\n'
    'hit space to start... < escape > to quit')
instructions.draw()
win.flip()
if 'escape' in event.waitKeys(['space', 'escape']):
    core.quit()