本文整理汇总了Python中pygaze._misc.misc.copy_docstr函数的典型用法代码示例。如果您正苦于以下问题:Python copy_docstr函数的具体用法?Python copy_docstr怎么用?Python copy_docstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了copy_docstr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, joybuttonlist=JOYBUTTONLIST, timeout=JOYTIMEOUT):
"""Initializes joystick object (joybuttonlist: list of buttons; timeout: timeout in ms)
arguments
None
keyword arguments
joybuttonlist -- list of joystick buttons that are allowed (e.g.
[0,2,4]) or None to allow all buttons
(default = JOYBUTTONLIST)
timeout -- time in milliseconds after which None is returned
on a call to a get_* method when no input is
registered (default = JOYTIMEOUT)
"""
# try to import copy docstring (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseJoystick, PyGameJoystick)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
# initialize joystick
pygame.init()
self.js = Joystick(0)
# set joystick characteristics
self.set_joybuttonlist(joybuttonlist)
self.set_timeout(timeout)
开发者ID:AA33,项目名称:PyGaze,代码行数:33,代码来源:pygamejoystick.py
示例2: __init__
def __init__(self, dispsize=settings.DISPSIZE, fgc=settings.FGC,
bgc=settings.BGC, screennr=settings.SCREENNR,
mousevisible=settings.MOUSEVISIBLE, screen=None, **args):
"""
Constructor.
TODO: docstring
"""
# try to copy docstring (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseScreen, PsychoPyScreen)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
self.dispsize = dispsize
self.fgc = fgc
self.bgc = bgc
self.screennr = screennr
self.mousevis = mousevisible
self.create(screen=screen)
开发者ID:KurtisReid,项目名称:PyGaze,代码行数:26,代码来源:psychopyscreen.py
示例3: __init__
def __init__(self, display):
"""Initiates a 'dumb dummy' object, that doesn't do a thing
arguments
display -- a pygaze display.Display instance
keyword arguments
None
"""
# try to copy docstrings (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseEyeTracker, DumbDummy)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
self.recording = False
self.blinking = False
self.bbpos = (DISPSIZE[0]/2, DISPSIZE[1]/2)
self.display = display
self.screen = Screen(disptype=DISPTYPE, mousevisible=False)
开发者ID:AA33,项目名称:PyGaze,代码行数:27,代码来源:libdumbdummy.py
示例4: __init__
def __init__(self, dispsize=settings.DISPSIZE, fgc=settings.FGC,
bgc=settings.BGC, screennr=settings.SCREENNR, screen=None, **args):
# See _display.basedisplay.BaseDisplay for documentation
# try to import copy docstring (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseDisplay, PsychoPyDisplay)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
self.dispsize = dispsize
self.fgc = fgc
self.bgc = bgc
self.screennr = screennr
self.mousevis = False
# create window
pygaze.expdisplay = Window(size=self.dispsize, pos=None,
color=rgb2psychorgb(self.bgc), colorSpace='rgb',
fullscr=settings.FULLSCREEN, screen=self.screennr, units='pix')
# set mouse visibility
pygaze.expdisplay.setMouseVisible(self.mousevis)
# get screen in window
if screen:
for s in screen.screen:
s.draw()
开发者ID:Versatilus,项目名称:PyGaze,代码行数:31,代码来源:psychopydisplay.py
示例5: __init__
def __init__(self, dispsize=settings.DISPSIZE, fgc=settings.FGC, bgc=settings.BGC, screen=None, **args):
# See _display.basedisplay.BaseDisplay for documentation
# try to import copy docstring (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseDisplay, PyGameDisplay)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
self.dispsize = dispsize
self.fgc = fgc
self.bgc = bgc
self.mousevis = False
# initialize PyGame display-module
pygame.display.init()
# make mouse invisible (should be so per default, but you never know)
pygame.mouse.set_visible(self.mousevis)
if settings.FULLSCREEN:
mode = pygame.FULLSCREEN | pygame.HWSURFACE | pygame.DOUBLEBUF
else:
mode = pygame.HWSURFACE | pygame.DOUBLEBUF
# create surface for full screen displaying
pygaze.expdisplay = pygame.display.set_mode(self.dispsize, mode)
# blit screen to display surface (if user entered one)
if screen:
pygaze.expdisplay.blit(screen.screen, (0, 0))
else:
pygaze.expdisplay.fill(self.bgc)
开发者ID:jockehewh,项目名称:PyGaze,代码行数:35,代码来源:pygamedisplay.py
示例6: __init__
def __init__(self, keylist=KEYLIST, timeout=KEYTIMEOUT):
# See _keyboard.basekeyboard.BaseKeyboard
# try to copy docstring (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseKeyboard, PyGameKeyboard)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
# dictionary for keynames and codes
self.key_codes = {}
for i in dir(pygame):
if i[:2] == "K_":
code = eval("pygame.%s" % i)
name1 = pygame.key.name(code).lower()
name2 = name1.upper()
name3 = i[2:].lower()
name4 = name3.upper()
self.key_codes[name1] = code
self.key_codes[name2] = code
self.key_codes[name3] = code
self.key_codes[name4] = code
# set keyboard characteristics
self.set_keylist(keylist)
self.set_timeout(timeout)
开发者ID:AA33,项目名称:PyGaze,代码行数:31,代码来源:pygamekeyboard.py
示例7: __init__
def __init__(self, osc=SOUNDOSCILLATOR, freq=SOUNDFREQUENCY, length=SOUNDLENGTH, attack=SOUNDATTACK, decay=SOUNDDECAY, soundfile=None):
# see pygaze._sound.basesound.BaseSound
# try to copy docstring (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseSound, PyGameSound)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
pygame.mixer.init(frequency=SOUNDSAMPLINGFREQUENCY, size=SOUNDSAMPLESIZE, channels=SOUNDCHANNELS, buffer=SOUNDBUFFERSIZE)
# if a sound file was specified, use soundfile and ignore other keyword arguments
if soundfile != None:
if not os.path.exists(soundfile):
raise Exception("Error in libsound.Player.__init__(): Sound file %s not found!" % soundfile)
if os.path.splitext(soundfile)[1].lower() not in (".ogg", ".wav"):
raise Exception("Error in libsound.Player.__init__(): Sound file %s is not in .ogg or .wav format!" % soundfile)
self.sound = pygame.mixer.Sound(soundfile)
# if no soundfile was specified, use keyword arguments to create sound
else:
if osc == 'sine':
_func = math.sin
elif osc == 'saw':
_func = self.saw
elif osc == 'square':
_func = self.square
elif osc == 'whitenoise':
_func = self.white_noise
else:
raise Exception("Error in libsound.Sound.__init__(): oscillator %s could not be recognized; oscillator is set to 'sine'." % osc)
l = []
attack = attack * SOUNDSAMPLINGFREQUENCY / 1000
decay = decay * SOUNDSAMPLINGFREQUENCY / 1000
amp = 32767 / 2
sps = SOUNDSAMPLINGFREQUENCY
cps = float(sps/freq) # cycles per sample
slen = SOUNDSAMPLINGFREQUENCY * length / 1000 # number of samples
for i in range(slen):
p = float((i % cps)) / cps * 2 * math.pi
v = int(amp * (_func(p)))
if i < attack:
v = int(v * float(i) / attack)
if i > slen - decay:
v = int(v * (float(slen) - float(i)) / decay)
l.append(v)
l.append(v)
b = numpy.array(l, dtype="int16").reshape(len(l) / 2, 2)
self.sound = pygame.mixer.Sound(b)
开发者ID:AA33,项目名称:PyGaze,代码行数:60,代码来源:pygamesound.py
示例8: __init__
def __init__(self, disptype=settings.DISPTYPE, **args):
"""
Initializes the Screen object.
Keyword arguments:
disptype -- Type of display: either 'pygame' or 'psychopy'
(default = DISPTYPE)
dispsize -- size of the display in pixels: a (width, height)
tuple (default = DISPSIZE)
fgc -- the foreground colour: a colour name (e.g. 'red') or
a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))
(default = FGC)
bgc -- the background colour: a colour name (e.g. 'red') or
a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))
(default = BGC)
screennr -- the screen number: 0, 1 etc. (default =
SCREENNR)
mousevisible -- Boolean indicating mouse visibility (default =
MOUSEVISIBLE)
screen -- a Screen object to be presented on the new Display
(default=None)
"""
if disptype == u'pygame':
from pygaze._screen.pygamescreen import PyGameScreen as Screen
elif disptype == u'psychopy':
from pygaze._screen.psychopyscreen import PsychoPyScreen as Screen
elif disptype == u'opensesame':
from pygaze._screen.osscreen import OSScreen as Screen
else:
raise Exception(u'Unexpected disptype : %s' % disptype)
self.__class__ = Screen
self.__class__.__init__(self, **args)
copy_docstr(BaseScreen, Screen)
开发者ID:KurtisReid,项目名称:PyGaze,代码行数:35,代码来源:screen.py
示例9: __init__
def __init__(self, display):
"""Initiates an eyetracker dummy object, that simulates gaze position using the mouse
arguments
display -- a pygaze display.Display instance
keyword arguments
None
"""
# try to copy docstrings (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseEyeTracker, Dummy)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
self.recording = False
self.blinking = False
self.bbpos = (settings.DISPSIZE[0]/2, settings.DISPSIZE[1]/2)
self.resolution = settings.DISPSIZE[:]
self.simulator = Mouse(disptype=settings.DISPTYPE, mousebuttonlist=None,
timeout=2, visible=False)
self.kb = Keyboard(disptype=settings.DISPTYPE, keylist=None,
timeout=None)
self.angrybeep = Sound(osc='saw',freq=100, length=100, attack=0,
decay=0, soundfile=None)
self.display = display
self.screen = Screen(disptype=settings.DISPTYPE, mousevisible=False)
开发者ID:esdalmaijer,项目名称:PyGaze,代码行数:33,代码来源:libdummytracker.py
示例10: __init__
def __init__(self, **args):
# See BaseLogfile
from pygaze._logfile.logfile import Logfile
self.__class__ = Logfile
self.__class__.__init__(self, **args)
copy_docstr(BaseLogfile, Logfile)
开发者ID:AA33,项目名称:PyGaze,代码行数:8,代码来源:logfile.py
示例11: __init__
def __init__(self, disptype=DISPTYPE, **args):
# see BaseJoystick
if disptype in (u'pygame', u'psychopy'):
from pygaze._joystick.pygamejoystick import PyGameJoystick
self.__class__ = PyGameJoystick
else:
raise Exception(u'Unexpected disptype : %s' % disptype)
self.__class__.__init__(self, **args)
copy_docstr(BaseJoystick, Joystick)
开发者ID:AA33,项目名称:PyGaze,代码行数:11,代码来源:joystick.py
示例12: __init__
def __init__(self):
# see pygaze._time.basetime.BaseTime
# try to copy docstring (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseTime, PsychoPyTime)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
pass
开发者ID:AA33,项目名称:PyGaze,代码行数:15,代码来源:psychopytime.py
示例13: __init__
def __init__(self, disptype=settings.DISPTYPE, **args):
"""
Initializes the Sound object.
TODO: docstring.
"""
if disptype in (u'pygame', u'psychopy', u'opensesame'):
from pygaze._sound.pygamesound import PyGameSound as Sound
else:
raise Exception(u'Unexpected disptype : %s' % disptype)
self.__class__ = Sound
self.__class__.__init__(self, **args)
copy_docstr(BaseSound, Sound)
开发者ID:KurtisReid,项目名称:PyGaze,代码行数:15,代码来源:sound.py
示例14: __init__
def __init__(self, disptype=DISPTYPE, **args):
# see BaseDisplay
if disptype == u'pygame':
from pygaze._display.pygamedisplay import PyGameDisplay as Display
elif disptype == u'psychopy':
from pygaze._display.psychopydisplay import PsychoPyDisplay as Display
elif disptype == u'opensesame':
from pygaze._display.osdisplay import OSDisplay as Display
else:
raise Exception(u'Unexpected disptype : %s' % disptype)
self.__class__ = Display
self.__class__.__init__(self, **args)
copy_docstr(BaseDisplay, Display)
开发者ID:AA33,项目名称:PyGaze,代码行数:15,代码来源:display.py
示例15: __init__
def __init__(self, screen=None, **args):
"""See _display.pygamescreen.PyGameScreen"""
# try to copy docstring (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseScreen, OSScreen)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
self.experiment = osexperiment
self.create(screen=screen)
开发者ID:AA33,项目名称:PyGaze,代码行数:16,代码来源:osscreen.py
示例16: __init__
def __init__(self, filename=settings.LOGFILE):
# See _logfile.baselogfile.BaseLogfile
# try to copy docstring (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseLogfile, Logfile)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
self.filename = filename + ".txt"
self.logfile = open(self.filename, "w")
开发者ID:KurtisReid,项目名称:PyGaze,代码行数:16,代码来源:logfile.py
示例17: __init__
def __init__(self, keylist=settings.KEYLIST, timeout=settings.KEYTIMEOUT):
# See _keyboard.basekeyboard.BaseKeyboard
# try to copy docstring (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseKeyboard, PsychoPyKeyboard)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
# keymap
self.keymap = {
'!' : 'exclamation',
'"' : 'doublequote',
'#' : 'hash',
'$' : 'dollar',
'&' : 'ampersand',
'\'' : 'quoteleft',
'(' : None,
')' : None,
'*' : 'asterisk',
'+' : 'plus',
',' : 'comma',
'-' : 'minus',
'.' : None,
'/' : 'slash',
':' : 'colin',
';' : 'semicolon',
'=' : 'equal',
'>' : 'greater',
'?' : 'question',
'@' : 'at',
'[' : 'bracketleft',
'\\' : 'backslash',
']' : 'bracketright',
'^' : None,
'_' : 'underscore'
}
# set keyboard characteristics
self.set_keylist(keylist)
self.set_timeout(timeout)
开发者ID:KurtisReid,项目名称:PyGaze,代码行数:46,代码来源:psychopykeyboard.py
示例18: __init__
def __init__(self, keylist=KEYLIST, timeout=KEYTIMEOUT):
# See _keyboard.basekeyboard.BaseKeyboard
# try to copy docstring (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseKeyboard, OSKeyboard)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
self.experiment = osexperiment
self.keyboard = keyboard(self.experiment, keylist=keylist, timeout= \
timeout)
开发者ID:Huettel-Lab,项目名称:EyeTribe_test,代码行数:17,代码来源:oskeyboard.py
示例19: __init__
def __init__(self, **args):
# See _display.basedisplay.BaseDisplay for documentation
# try to import copy docstring (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseDisplay, OSDisplay)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
self.experiment = settings.osexperiment
self.canvas = canvas(self.experiment)
self.dispsize = self.experiment.resolution()
开发者ID:KurtisReid,项目名称:PyGaze,代码行数:17,代码来源:osdisplay.py
示例20: __init__
def __init__(self, mousebuttonlist=MOUSEBUTTONLIST, timeout=MOUSETIMEOUT, visible=False):
# See _mouse.basemouse.BaseMouse
# try to copy docstring (but ignore it if it fails, as we do
# not need it for actual functioning of the code)
try:
copy_docstr(BaseMouse, PyGameMouse)
except:
# we're not even going to show a warning, since the copied
# docstring is useful for code editors; these load the docs
# in a non-verbose manner, so warning messages would be lost
pass
# set mouse characteristics
self.set_mousebuttonlist(mousebuttonlist)
self.set_timeout(timeout)
self.set_visible(visible=visible)
开发者ID:AA33,项目名称:PyGaze,代码行数:18,代码来源:pygamemouse.py
注:本文中的pygaze._misc.misc.copy_docstr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论