|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import pygame
from pygame.locals import *
pygame.init()
win = pygame.display.set_mode((800,600))
#常数
right = (150,300)
left = (650,300)
red = (255,0,0)
blue = (0,0,255)
black = (0,0,0)
#变量
loc = ['R','L']
col = ['R','B']
C1 = ['R','R','s']
C2 = ['R','B','k']
C3 = ['L','R','s']
C4 = ['L','B','k']
# run a single trial
def run_trial(pars):
""" pars should be list that specifies the
location and color of the stimulus, as well as
the correct key response, such as ['R', 'B', '/']"""
l, c, cor_resp = pars
if l == 'R': loc = right
if l == 'L': loc = left
if c == 'R': col = red
if c == 'B': col = blue
print(loc,col)
run_trial(C1)
pygame.draw.circle(win,col,loc,5)
pygame.display.flip()
|
|