def __init__(self, size=None, position=None, line_width=None, colour=None, anti_aliasing=None, cross_size=None): """Create a fixation cross. Parameters ---------- size : (int, int), optional size of the cross position : (int, int), optional position of the stimulus line_width : int optional width of the lines colour : (int, int, int), optional colour of the cross anti_aliasing : int, optional anti aliasing parameter (good anti_aliasing with 10) NOTE ---- The parameter cross_size is now OBSOLETE. Please use 'size' and specify x and y dimensions. """ if cross_size is not None and size is None: raise DeprecationWarning("Property cross_size is obsolete. Please use size") if position is None: position = defaults.fixcross_position if colour is None: colour = defaults.fixcross_colour if colour is not None: self._colour = colour else: self._colour = expyriment._active_exp.foreground_colour if anti_aliasing is None: anti_aliasing = defaults.fixcross_anti_aliasing Shape.__init__(self, position=position, line_width=0, colour=colour, anti_aliasing=anti_aliasing) if size is None: size = defaults.fixcross_size if line_width is None: line_width = defaults.fixcross_line_width self._size = size x = (self._size[0] - line_width) / 2 y = (self._size[1] - line_width) / 2 self.add_vertex((line_width, 0)) self.add_vertex((0, -y)) self.add_vertex((x, 0)) self.add_vertex((0, -line_width)) self.add_vertex((-x, 0)) self.add_vertex((0, -y)) self.add_vertex((-line_width, 0)) self.add_vertex((0, y)) self.add_vertex((-x, 0)) self.add_vertex((0, line_width)) self.add_vertex((x, 0))
def __init__(self, size, position=None, frame_line_width=None, colour=None, anti_aliasing=None, line_width=None): """Create a frame. Parameters ---------- size : (int, int) size of the frame (xy) position : (int, int), optional position of the stimulus frame_line_width : int, optional width of the frame lines colour : (int, int, int), optional colour of the frame anti_aliasing : int, optional anti aliasing parameter Notes ----- DEPRECATED CLASS: Please use 'Rectangle' with a line_width > 0! """ if position is None: position = defaults.frame_position if colour is None: colour = defaults.frame_colour if anti_aliasing is None: anti_aliasing = defaults.frame_anti_aliasing Shape.__init__(self, position=position, colour=colour, line_width=0, anti_aliasing=anti_aliasing) if frame_line_width is None: frame_line_width = defaults.frame_frame_line_width if line_width is not None: message = "Frame: line_width attribute have been renamed! " +\ "Please use frame_line_width." raise RuntimeError(message) self._frame_size = list(size) self._frame_line_width = frame_line_width l1 = self._frame_size[0] l2 = self._frame_size[1] l3 = int(l1 - (self._frame_line_width * 2.0)) l4 = int(l2 - (self._frame_line_width * 2.0)) self.add_vertex((l1, 0)) self.add_vertex((0, l2)) self.add_vertex((-l1, 0)) self.add_vertex((0, -l2 + self._frame_line_width)) self.add_vertex((self._frame_line_width , 0)) self.add_vertex((0, l4 - 1)) self.add_vertex((l3, 0)) self.add_vertex((0, -l4 + 1)) self.add_vertex((-l3 - self._frame_line_width, 0))
def __init__(self, size=None, position=None, line_width=None, colour=None, anti_aliasing=None, cross_size=None): """Create a fixation cross. Parameters ---------- size : (int, int), optional size of the cross position : (int, int), optional position of the stimulus line_width : (int, int), optional width of the lines colour : (int, int), optional colour of the cross anti_aliasing : (int, int), optional anti aliasing parameter cross_size : (int, int) DEPRECATED argument please use 'size' and specify x and y dimensions. """ if cross_size is not None and size is None: size = (cross_size, cross_size) if position is None: position = defaults.fixcross_position if colour is None: colour = defaults.fixcross_colour if colour is not None: self._colour = colour else: self._colour = expyriment._active_exp.foreground_colour if anti_aliasing is None: anti_aliasing = defaults.fixcross_anti_aliasing Shape.__init__(self, position=position, colour=colour, anti_aliasing=anti_aliasing) if size is None: size = defaults.fixcross_size if line_width is None: line_width = defaults.fixcross_line_width self._size = size self._line_width = line_width x = (self._size[0] - line_width) / 2 y = (self._size[1] - line_width) / 2 self.add_vertex((line_width, 0)) self.add_vertex((0, -y)) self.add_vertex((x, 0)) self.add_vertex((0, -line_width)) self.add_vertex((-x, 0)) self.add_vertex((0, -y)) self.add_vertex((-line_width , 0)) self.add_vertex((0, y)) self.add_vertex((-x, 0)) self.add_vertex((0, line_width)) self.add_vertex((x, 0))
def __init__(self, size=None, position=None, line_width=None, colour=None, anti_aliasing=None, cross_size=None): """Create a fixation cross. Parameters ---------- size : (int, int), optional size of the cross position : (int, int), optional position of the stimulus line_width : int optional width of the lines colour : (int, int, int), optional colour of the cross anti_aliasing : int, optional anti aliasing parameter (good anti_aliasing with 10) NOTE ---- The parameter cross_size is now OBSOLETE. Please use 'size' and specify x and y dimensions. """ if cross_size is not None and size is None: raise DeprecationWarning( "Property cross_size is obsolete. Please use size") if position is None: position = defaults.fixcross_position if colour is None: colour = defaults.fixcross_colour if colour is not None: self._colour = colour else: self._colour = expyriment._active_exp.foreground_colour if anti_aliasing is None: anti_aliasing = defaults.fixcross_anti_aliasing Shape.__init__(self, position=position, line_width=0, colour=colour, anti_aliasing=anti_aliasing) if size is None: size = defaults.fixcross_size if line_width is None: line_width = defaults.fixcross_line_width self._size = size x = (self._size[0] - line_width) / 2 y = (self._size[1] - line_width) / 2 self.add_vertex((line_width, 0)) self.add_vertex((0, -y)) self.add_vertex((x, 0)) self.add_vertex((0, -line_width)) self.add_vertex((-x, 0)) self.add_vertex((0, -y)) self.add_vertex((-line_width, 0)) self.add_vertex((0, y)) self.add_vertex((-x, 0)) self.add_vertex((0, line_width)) self.add_vertex((x, 0))