def ellipse(self, x, y, w, h): if self.fill: line_width = 0 else: line_width = self.penwidth pos = self.to_xy((x+w/2,y+h/2)) stim = stimuli.Ellipse((w/2, h/2), colour=self.color.backend_color, line_width=line_width, position=pos) self.add_stim(stim)
def ellipse(self, x, y, w, h, fill=False, color=None): """See openexp._canvas.legacy""" if color != None: color = self.color(color) else: color = self.fgcolor if fill: line_width = 0 else: line_width = self.penwidth pos = c2p((x + w / 2, y + h / 2)) stim = stimuli.Ellipse((w, h), colour=color, line_width=line_width, \ position=pos) self.add_stim(stim)
def ellipse(self, x, y, w, h, fill=False, color=None, penwidth=None): if color != None: color = self.color(color) else: color = self.fgcolor if penwidth == None: penwidth = self.penwidth else: line_width = penwidth if fill: line_width = 0 elif penwidth != None: line_width = penwidth else: line_width = self.penwidth pos = c2p((x+w/2,y+h/2)) stim = stimuli.Ellipse((w, h), colour=color, line_width=line_width, position=pos) self.add_stim(stim)
def __init__(self, paradict, midline=100, distance=30): # Assign self.nid = paradict['nid'] self.name = paradict['name'] self.prefix = paradict['prefix'] self.colour = constants.C_BLACK self.key = paradict['key'] self.key_coded = eval("constants.K_" + paradict['keyboard']) self.clef = paradict['clef'] self.position_factor = paradict['position_factor'] self.position_y = midline + (self.position_factor * distance / 2) self.position = [0, self.position_y] # standard values for each note self.size = [distance, distance / 2] self.stimuli = stimuli.Ellipse(self.size, colour=self.colour, position=self.position) self.count = 0 self.RTs = np.array([]) self.str_rt = "" self.misses = 0 self.Feedback_text = "" self.str_mean = "" # Parameter for help lines outsite five music sheet lines self.help_lines = list() if self.position_factor <= -6: # range (a,b) needs to have a lower b to initiate array with first element for line in range (-6, self.position_factor -1, -2): self.help_lines.append({ 'start_point': [-1.2 * distance, midline + (line * distance / 2)], 'end_point': [1.2 * distance, midline + (line * distance / 2)], 'line_width': 1, 'colour': self.colour, }) else: if self.position_factor >= 6: # range (a,b) needs to have a lower b to initiate array with first element for line in range (6, self.position_factor +1, 2): self.help_lines.append({ 'start_point': [-1.2 * distance, midline + (line * distance / 2)], 'end_point': [1.2 * distance, midline + (line * distance / 2)], 'line_width': 2, 'colour': self.colour, })