def setup(self,
              nrows,
              nrows_center = 1,
              check_width = None,
              check_width_center = 0.5,
              check_color1 = 'white',
              check_color2 = 'black',
              screen_background_color = 'neutral-gray',
              show_fixation_dot = False,
              flash_rate_left = DEFAULT_FLASH_RATE,
              flash_rate_right = DEFAULT_FLASH_RATE,
              flash_rate_center = DEFAULT_FLASH_RATE,
              #rate_compensation = None,
              vsync_patch = None,
             ):
        Screen.setup(self,
                     background_color = screen_background_color,
                     vsync_patch = vsync_patch,
                     )

        #run colors through filter to catch names and convert to RGB
        check_color1 = COLORS.get(check_color1, check_color1)
        check_color2 = COLORS.get(check_color2, check_color2)

        # set checkerboard-related attributes
        if check_width is None:
            check_width = 2.0/nrows #fill whole screen
        self.board_width = check_width*nrows
        self.board_width_center = check_width_center * nrows_center
        self.nrows = nrows
        self.CB1 = CheckerBoard(nrows, check_width, color1 = check_color1, color2 = check_color2, show_fixation_dot = show_fixation_dot)
        self.CB2 = CheckerBoard(nrows, check_width, color1 = check_color2, color2 = check_color1, show_fixation_dot = show_fixation_dot) #reversed pattern
        self.CB1_center = CheckerBoard(nrows_center, check_width_center, color1 = check_color1, color2 = check_color2, show_fixation_dot = False)#show_fixation_dot)
        self.CB2_center = CheckerBoard(nrows_center, check_width_center, color1 = check_color2, color2 = check_color1, show_fixation_dot = False)#show_fixation_dot)
        self.CB_cycle_left = itertools.cycle((self.CB1,self.CB2))
        self.CB_cycle_right = itertools.cycle((self.CB1,self.CB2))
        self.CB_cycle_center = itertools.cycle((self.CB1_center,self.CB2_center))

        # set time-related attributes
        self._last_CB_change_time_left = None
        self._last_CB_change_time_right = None
        self._last_CB_change_time_center = None
        self.flash_rate_left  = flash_rate_left
        self.flash_interval_left = 1.0/flash_rate_left
        self.flash_rate_right = flash_rate_right
        self.flash_interval_right = 1.0/flash_rate_right
        self.flash_rate_center = flash_rate_center
        self.flash_interval_center = 1.0/flash_rate_center
        #self.rate_compensation = rate_compensation

        # get useful coordinate values for checkerboard rendering locations
        self.xC, self.yC = (-0.5*self.board_width,-0.5*self.board_width)
        self.xL, self.yL = (self.xC - 0.7*self.screen_right, self.yC)
        self.xR, self.yR = (self.xC + 0.7*self.screen_right, self.yC)

        # some lists for checking things
        self.vals = itertools.cycle((1,0))
        self.t_list = []
        self.val_list = []
        self.vals_current = self.vals.next()
    def setup(
        self,
        nrows,
        check_width=None,
        check_color1="white",
        check_color2="black",
        screen_background_color="neutral-gray",
        show_fixation_dot=False,
        flash_rate_left=DEFAULT_FLASH_RATE,
        flash_rate_right=DEFAULT_FLASH_RATE,
        # rate_compensation = None,
        vsync_patch="bottom-right",
        vsync_value=None,
    ):
        Screen.setup(self, background_color=screen_background_color, vsync_patch=vsync_patch)

        # run colors through filter to catch names and convert to RGB
        check_color1 = COLORS.get(check_color1, check_color1)
        check_color2 = COLORS.get(check_color2, check_color2)

        # set checkerboard-related attributes
        if check_width is None:
            check_width = 2.0 / nrows  # fill whole screen
        self.board_width = check_width * nrows
        self.nrows = nrows
        self.CB1 = CheckerBoard(
            nrows, check_width, color1=check_color1, color2=check_color2, show_fixation_dot=show_fixation_dot
        )
        self.CB2 = CheckerBoard(
            nrows, check_width, color1=check_color2, color2=check_color1, show_fixation_dot=show_fixation_dot
        )  # reversed pattern
        self.CB_cycle_left = itertools.cycle((self.CB1, self.CB2))
        self.CB_cycle_right = itertools.cycle((self.CB1, self.CB2))

        # set time-related attributes
        self._last_CB_change_time_left = None
        self._last_CB_change_time_right = None
        self.flash_rate_left = flash_rate_left
        self.flash_interval_left = 1.0 / flash_rate_left
        self.flash_rate_right = flash_rate_right
        self.flash_interval_right = 1.0 / flash_rate_right
        # self.rate_compensation = rate_compensation

        # get useful coordinate values for checkerboard rendering locations
        self.xC, self.yC = (-0.5 * self.board_width, -0.5 * self.board_width)
        self.xL, self.yL = (self.xC - 0.5 * self.screen_right, self.yC)
        self.xR, self.yR = (self.xC + 0.5 * self.screen_right, self.yC)
    def setup(self,
              nrows,
              check_width = None,
              check_color1 = 'white',
              check_color2 = 'black',
              screen_background_color = 'neutral-gray',
              fixation_dot_color = None,
              flash_rate = DEFAULT_FLASH_RATE,
              #rate_compensation = None,
              vsync_patch = "bottom-right",
              vsync_value = None,
             ):
        Screen.setup(self,
                     background_color = screen_background_color,
                     vsync_patch = vsync_patch,
                     )

        #run colors through filter to catch names and convert to RGB
        check_color1 = COLORS.get(check_color1, check_color1)
        check_color2 = COLORS.get(check_color2, check_color2)

        # set checkerboard-related attributes
        if check_width is None:
            check_width = 2.0/nrows #fill whole screen
        self.board_width = check_width*nrows
        self.nrows = nrows
        self.CB1 = CheckerBoard(nrows, check_width, color1 = check_color1, color2 = check_color2, fixation_dot_color = fixation_dot_color)
        self.CB2 = CheckerBoard(nrows, check_width, color1 = check_color2, color2 = check_color1, fixation_dot_color = fixation_dot_color) #reversed pattern
        self.CB_cycle = itertools.cycle((self.CB1,self.CB2))

        # set time-related attributes
        self._last_CB_change_time = None
        self.flash_rate  = flash_rate
        self.flash_interval = 1.0/flash_rate
        #self.rate_compensation = rate_compensation

        # get useful coordinate values for checkerboard rendering locations
        self.xC, self.yC = (-0.5*self.board_width,-0.5*self.board_width)
예제 #4
0
 def __init__(self,
              nrows,
              check_width = 1.0,
              check_height = None,
              color1 = COLORS['white'],
              color2 = COLORS['black'],
              fixation_dot_color = None,
              ):
     self.nrows = int(nrows)
     if check_width is None:
         check_width = 2.0/nrows #fill whole screen
     self.check_width = check_width
     if check_height is None:
         check_height = check_width
     self.check_height = check_height
     self.board_width = check_width*nrows
     #run colors through filter to catch names and convert to RGB
     color1 = COLORS.get(color1, color1)
     color2 = COLORS.get(color2, color2)
     self.color1 = color1
     self.color2 = color2
     self.fixation_dot_color = fixation_dot_color
     self.display_list_multi = None  #for cached rendering of multiple display lists, leaving ability to change color
예제 #5
0
    def setup(self,
              text_content = "DEFAULT",
              text_color = 'black',
              text_bgColor = None,
              font_size = 288,
              font_type = None,
              screen_background_color = 'white',
              scale_refObj = None,
              **kwargs
             ):
        Screen.setup(self,
                     background_color = screen_background_color,
                     **kwargs
                    )
        #if text_bgColor is unspecified, set to same as background color (renders faster than using alpha)
        if text_bgColor == None:
            text_bgColor = screen_background_color

        self.text_content = text_content
        self.text_color   = COLORS.get(text_color,   text_color)
        self.text_bgColor = COLORS.get(text_bgColor, text_bgColor)
        self.font_size = font_size
        self.font_type = font_type
        self.scale_refObj = scale_refObj
예제 #6
0
 def __init__(self, position=(0, 0), size=0.1, thickness=0.01, color="white"):
     self.position = x, y = position
     self.size = size
     self.thickness = thickness
     self.color = COLORS.get(color, color)
     self.vertices = [  # horizontal beam
         (x - size / 2.0, y + thickness / 2),  # left-top
         (x - size / 2.0, y - thickness / 2),  # left-bottom
         (x + size / 2.0, y - thickness / 2),  # right-bottom
         (x + size / 2.0, y + thickness / 2),  # right-top
         # vertical beam
         (x - thickness / 2, y + size / 2.0),  # left-top
         (x - thickness / 2, y - size / 2.0),  # left-bottom
         (x + thickness / 2, y - size / 2.0),  # right-bottom
         (x + thickness / 2, y + size / 2.0),  # right-top
     ]
예제 #7
0
    def setup(self,
              background_color = "black",
              vsync_value  = None,
              vsync_patch  = "bottom-right",
              fixation_cross = None,
              exit_keys = None,
             ):

        self.background_color = COLORS.get(background_color, background_color)

        self.vsync_value = vsync_value
        if vsync_patch == "bottom-right":
            #define the vsync patch as being in the bottom right corner
            self.vsync_patch = VsyncPatch.make_bottom_right(screen_bottom = self.screen_bottom,
                                                            screen_right  = self.screen_right)
        else:
            self.vsync_patch = vsync_patch
        self.fixation_cross = fixation_cross
        self.exit_value = None
        if exit_keys is None:
            exit_keys = []
        self.exit_keys = exit_keys
 def __init__(self, size=0.1, thickness=0.01, color="white", **kwargs):
     Sprite.__init__(self, **kwargs)
     self.size = size
     self.thickness = thickness
     self.color = COLORS.get(color, color)