def __init__(self, experiment, **resp_args): """ desc: | Constructor to create a new `mouse` object. You do not generally call this constructor directly, but use the `mouse()` function, which is described here: [/python/common/](). arguments: experiment: desc: The experiment object. type: experiment keyword-dict: resp_args: Optional [response keywords] that will be used as the default for this `mouse` object. example: | my_mouse = mouse(buttonlist=[1, 2], timeout=2000) """ self.experiment = experiment self._cursor_shown = False backend.__init__(self, configurables={ u'timeout' : self.assert_numeric_or_None, u'buttonlist' : self.assert_list_or_None, u'visible' : self.assert_bool, }, **resp_args)
def __init__(self, experiment, **resp_args): """ desc: | Constructor to create a new `keyboard` object. You do not generally call this constructor directly, but use the `keyboard()` function, which is described here: [/python/common/](). arguments: experiment: desc: The experiment object. type: experiment keyword-dict: resp_args: Optional [response keywords] (`timeout` and `keylist`) that will be used as the default for this `keyboard` object. example: | my_keyboard = keyboard(keylist=['z', 'm'], timeout=2000) """ self.experiment = experiment backend.__init__(self, configurables={ u'timeout' : self.assert_numeric_or_None, u'keylist' : self.assert_list_or_None, }, **resp_args)
def __init__(self, experiment, **resp_args): """ desc: | Constructor to create a new `keyboard` object. You do not generally call this constructor directly, but use the `keyboard()` function, which is described here: [/python/common/](). arguments: experiment: desc: The experiment object. type: experiment keyword-dict: resp_args: Optional [response keywords] (`timeout` and `keylist`) that will be used as the default for this `keyboard` object. example: | my_keyboard = keyboard(keylist=['z', 'm'], timeout=2000) """ self.experiment = experiment backend.__init__(self, configurables={ u'timeout': self.assert_numeric_or_None, u'keylist': self.assert_list_or_None, }, **resp_args)
def __init__(self, experiment, src, **playback_args): """ desc: | Constructor to create a new `sampler` object. You do not generally call this constructor directly, but use the `sampler()` function, which is described here: [/python/sampler/](). arguments: experiment: desc: The experiment object. type: experiment src: desc: The full path to a `.wav` or `.ogg` file. type: [unicode, str] keyword-dict: playback_args: Optional [playback keywords] that will be used as the default for this `sampler` object. example: | src = exp.pool[u'my_sound.ogg'] my_sampler = sampler(src, volume=.5) """ self.experiment = experiment backend.__init__(self, configurables={ u'volume' : self.assert_numeric, u'pan' : self.assert_pan, u'pitch' : self.assert_numeric, u'duration' : self.assert_numeric_or_None, u'fade_in' : self.assert_numeric_or_None, u'block' : self.assert_bool, }, **playback_args)
def __init__(self, experiment, **resp_args): """ desc: | Constructor to create a new `mouse` object. You do not generally call this constructor directly, but use the `mouse()` function, which is described here: [/python/common/](). arguments: experiment: desc: The experiment object. type: experiment keyword-dict: resp_args: Optional [response keywords] that will be used as the default for this `mouse` object. example: | my_mouse = mouse(buttonlist=[1, 2], timeout=2000) """ self.experiment = experiment self._cursor_shown = False backend.__init__(self, configurables={ u'timeout': self.assert_numeric_or_None, u'buttonlist': self.assert_list_or_None, u'visible': self.assert_bool, }, **resp_args)
def __init__(self, experiment, src, **playback_args): """ desc: | Constructor to create a new SAMPLER object. You do not generally call this constructor directly, but use the `sampler()` function, which is described here: [/python/sampler/](). arguments: experiment: desc: The experiment object. type: experiment src: desc: The full path to a `.wav` or `.ogg` file. type: [unicode, str] keyword-dict: playback_args: Optional [playback keywords] that will be used as the default for this SAMPLER object. example: | src = exp.pool[u'my_sound.ogg'] my_sampler = sampler(src, volume=.5) """ self.experiment = experiment backend.__init__(self, configurables={ u'volume': self.assert_numeric, u'pan': self.assert_pan, u'pitch': self.assert_numeric, u'duration': self.assert_numeric_or_None, u'fade_in': self.assert_numeric_or_None, u'block': self.assert_bool, }, **playback_args)
def __init__(self, experiment, auto_prepare=True, **style_args): """ desc: | Constructor to create a new `canvas` object. You do not generally call this constructor directly, but use the `canvas()` function, which is described here: [/python/common/](). arguments: experiment: desc: The experiment object. type: experiment keywords: auto_prepare: desc: Indicates whether the canvas should be automatically prepared after each drawing operation, so that [canvas.show] will be maximally efficient. If auto_prepare is turned off, drawing operations may be faster, but [canvas.show] will take longer, unless [canvas.prepare] is explicitly called in advance. Generally, it only makes sense to disable auto_prepare when you want to draw a large number of stimuli, as in the second example above. Currently, the auto_prepare parameter only applies to the xpyriment backend, and is ignored by the other backends. type: bool keyword-dict: style_args: Optional [style keywords], which will be used as the default for all drawing operations on this `canvas`. example: | # Example 1: Show a central fixation dot. my_canvas = canvas() my_canvas.fixdot() my_canvas.show() # Example 2: Show many randomly positioned fixation dot. Here we # disable `auto_prepare`, so that drawing goes more quickly. from random import randint my_canvas = canvas(auto_prepare=False) for i in range(1000): x = randint(0, my_canvas.width) y = randint(0, my_canvas.height) my_canvas.fixdot(x, y) my_canvas.prepare() my_canvas.show() """ self.experiment = experiment self._width = self.experiment.var.width self._height = self.experiment.var.height self.auto_prepare = auto_prepare backend.__init__(self, configurables={ u'color' : None, u'background_color' : None, u'fill' : self.assert_bool, u'penwidth' : self.assert_numeric, u'bidi' : self.assert_bool, u'html' : self.assert_bool, u'font_family' : self.assert_string, u'font_size' : self.assert_numeric, u'font_italic' : self.assert_bool, u'font_bold' : self.assert_bool, u'font_underline' : self.assert_bool, }, **style_args) self.html_renderer = html()