Пример #1
0
# create text stim for instructions
keystext = "PRESS 'q' or 'escape' to Quit.\n"
keystext += "'s': Stop and restart\n"
keystext += "'p': Pause/unpause\n"
keystext += "'>': Seek forward 1 second\n"
keystext += "'<': Seek backward 1 second\n"
keystext += "'-': Decrease volume\n"
keystext += "'+': Increase volume"
text = visual.TextStim(win, keystext, pos=(0, -250), units='pix')

# Create your movie stim
mov = visual.VlcMovieStim(
    win,
    videopath,
    size=600,  # set as `None` to use the native video size
    pos=[0, 0],  # pos specifies the /center/ of the movie stim location
    flipVert=False,  # flip the video picture vertically
    flipHoriz=False,  # flip the video picture horizontally
    loop=False,  # replay the video when it reaches the end
    autoStart=True)  # start the video automatically when first drawn

# main loop, will exit automatically when the movie is finished
while not mov.isFinished:
    # Check for action keys.....
    for key in event.getKeys():
        if key in ['escape', 'q']:
            mov.stop()
            core.quit()
        elif key in [
                's',
        ]:
                    allowStencil=False,
                    monitor='testMonitor',
                    color=[-1, -1, -1],
                    colorSpace='rgb',
                    blendMode='avg',
                    useFBO=True,
                    units='height')

experimenter_text = visual.TextStim(win,
                                    "IT'S A MOVIE",
                                    pos=(0, -450),
                                    units='pix')

mov = visual.VlcMovieStim(win,
                          videopath,
                          units=None,
                          pos=(0, 0.15),
                          loop=False)

mov.size = (1.0, .5625)

# ------Prepare to start Routine "experimenter"-------
shouldflip = mov.play()
continueRoutine = True
while continueRoutine:
    # Only flip when a new frame should be displayed.
    if shouldflip:
        # Movie has already been drawn, so just draw text stim and flip
        experimenter_text.draw()
        win.flip()
    else:
expInfo['psychopyVersion'] = psychopyVersion

win = visual.Window(screen=1,
                    fullscr=True,
                    allowGUI=False,
                    allowStencil=False,
                    monitor='testMonitor',
                    color=[-1, -1, -1],
                    colorSpace='rgb',
                    blendMode='avg',
                    useFBO=True,
                    units='height')

mov = visual.VlcMovieStim(win,
                          video,
                          units=None,
                          pos=(0, 0.15),
                          size=(1.0, .5625),
                          loop=False)

match = re.search("afc_(\d+)", video)
if match:
    expInfo['participant'] = match.group(1)
    experimenter_text = visual.TextStim(
        win,
        "Press 'space' if this is the correct video and participant is number %s.\n\nThen, turn the monitor to face the participant.\n\nIf this is incorrect, press 'q' or 'Esc' to start over and check %s for correct video."
        % (expInfo['participant'], video_folder),
        pos=(0, -0.2),
        height=0.02)
else:
    expInfo['participant'] = "UNKNOWN"
    experimenter_text = visual.TextStim(
Пример #4
0
keystext = "PRESS 'q' or 'escape' to Quit.\n"
keystext += "  #     's': Stop/restart Movie.\n"
keystext += "  #     'p': Pause/Unpause Movie.\n"
keystext += "  #     '>': Seek Forward 1 Second.\n"
keystext += "  #     '<': Seek Backward 1 Second.\n"
keystext += "  #     '-': Decrease Movie Volume.\n"
keystext += "  #     '+': Increase Movie Volume."

text = visual.TextStim(win, keystext, pos=(0, -250), units='pix')

# Create your movie stim.
mov = visual.VlcMovieStim(
    win,
    videopath,
    size=640,
    # pos specifies the /center/ of the movie stim location
    pos=[0, 100],
    flipVert=False,
    flipHoriz=False,
    loop=False)

# Start the movie stim by preparing it to play
shouldflip = mov.play()
while mov.status != visual.FINISHED:
    # Only flip when a new frame should be displayed. Can significantly reduce
    # CPU usage. This only makes sense if the movie is the only /dynamic/ stim
    # displayed.
    if shouldflip:
        # Movie has already been drawn , so just draw text stim and flip
        text.draw()
        win.flip()