Существует модуль LSL для Python, называемый pylsl. Вы должны включить это в свой игровой цикл.
Следующий код был адаптирован из this example:
from pylsl import StreamInlet, resolve_stream
import pygame
# first resolve an EEG stream on the lab network
streams = resolve_stream('type', 'EEG')
# create a new inlet to read from the stream
inlet = StreamInlet(streams[0])
# Pygame setup
pygame.init()
size = width, height = 320, 240
screen = pygame.display.set_mode(size)
samples = []
while True:
# get a new sample (you can also omit the timestamp part if you're not
# interested in it)
# Get a sample from the inlet stream
sample, timestamp = inlet.pull_sample()
samples.push(sample)
#TODO: interperate stream and update game objects accordingly.
# You'll probably need to keep a few samples to interpret this data.
#TODO: draw game
...
pygame.display.flip()
Совершенные спасибо :) –