当前位置: 首页>>代码示例>>Python>>正文


Python Computer.getTime方法代码示例

本文整理汇总了Python中psychopy.iohub.Computer.getTime方法的典型用法代码示例。如果您正苦于以下问题:Python Computer.getTime方法的具体用法?Python Computer.getTime怎么用?Python Computer.getTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在psychopy.iohub.Computer的用法示例。


在下文中一共展示了Computer.getTime方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pumpMsgTasklet

# 需要导入模块: from psychopy.iohub import Computer [as 别名]
# 或者: from psychopy.iohub.Computer import getTime [as 别名]
 def pumpMsgTasklet(self, sleep_interval):
     import pythoncom
     while self._running:
         stime=Computer.getTime()
         if pythoncom.PumpWaitingMessages() == 1:
             break
         dur = sleep_interval - (Computer.getTime()-stime)
         gevent.sleep(max(0.0, dur))
开发者ID:NSalem,项目名称:psychopy,代码行数:10,代码来源:server.py

示例2: checkForEvents

# 需要导入模块: from psychopy.iohub import Computer [as 别名]
# 或者: from psychopy.iohub.Computer import getTime [as 别名]
 def checkForEvents(self):
     # get the time we request events from the ioHub
     stime=Computer.getTime()
     r = self.hub.getEvents()
     if r and len(r) > 0:
         # so there were events returned in the request, so include this getEvent request in the tally
         etime=Computer.getTime()
         dur=etime-stime
         return r, dur*1000.0
     return None,None
开发者ID:hsogo,项目名称:psychopy,代码行数:12,代码来源:run.py

示例3: test_getTime

# 需要导入模块: from psychopy.iohub import Computer [as 别名]
# 或者: from psychopy.iohub.Computer import getTime [as 别名]
    def test_getTime(self):
        ta = Computer.currentSec()
        tb = Computer.currentTime()
        tc = Computer.getTime()
        tp = getTime()

        assert ta < tb < tc < tp
        assert tp - ta < 0.002
开发者ID:Lx37,项目名称:psychopy,代码行数:10,代码来源:test_computer.py

示例4: run

# 需要导入模块: from psychopy.iohub import Computer [as 别名]
# 或者: from psychopy.iohub.Computer import getTime [as 别名]
    def run(self,*args):
        """
        The run method contains your experiment logic. It is equal to what 
        would be in your main psychopy experiment script.py file in a standard 
        psychopy experiment setup. That is all there is too it really.
        """
        run_demo=True
     
        kb=self.hub.devices.kb
        evt_sub=self.hub.devices.evt_sub
            
        # This demo does not display a PsychoPy window, instead it just prints
        # keyboard event info. received from the local keyboard device and keyboard
        # events received from the RemoteEventSubscriber device. Inform the user of this...
        # 
        msg_dialog=MessageDialog("This demo does not create a PsychoPy window.\nInstead local and subscribed keyboard event info is simply printed to stdout.\n\nOnce the demo has started, press 'ESCAPE' to quit.\n\nPress OK to continue or Cancel to abort the demo.",
                     title="PsychoPy.ioHub PUB - SUB Event Demo", 
                     dialogType=MessageDialog.IMPORTANT_DIALOG,display_index=0)

        if msg_dialog.show() == MessageDialog.OK_RESULT:
            # wait until 'ESCAPE' is pressed, or quit after 15 seconds of no kb events.
            self.hub.clearEvents('all')
            last_event_time=Computer.getTime()
            while run_demo is True and Computer.getTime()-last_event_time<15.0:
                local_kb_events=kb.getEvents()
                for event in local_kb_events:
                    print('* Local KB Event: {etime}\t{ekey}\t{edelay}'.format(
                        etime=event.time,ekey=event.key,edelay=event.delay))
                    last_event_time=event.time
                    if event.key == u'ESCAPE':
                        run_demo=False
                        break
                subscribed_kb_events=evt_sub.getEvents()
                for event in subscribed_kb_events:
                    print('# Subscribed KB Event: {etime}\t{ekey}\t{edelay}'.format(
                        etime=event.time, ekey=event.key,edelay=event.delay))
                self.hub.wait(0.1)
开发者ID:ChenTzuYin,项目名称:psychopy,代码行数:39,代码来源:run.py

示例5: test_getTime

# 需要导入模块: from psychopy.iohub import Computer [as 别名]
# 或者: from psychopy.iohub.Computer import getTime [as 别名]
    def test_getTime(self):
        ta = Computer.currentSec()
        tb = Computer.currentTime()
        tc = Computer.getTime()
        tp = getTime()

        assert ta <= tb <= tc <= tp
        assert tp - ta < 0.002

        ta = getTime()
        tb = self.io.getTime()
        tc = self.io.getTime()
        tp = getTime()

        assert ta <= tb <= tc <= tp
        assert tp - ta < 0.01
开发者ID:DennisEckmeier,项目名称:psychopy,代码行数:18,代码来源:test_computer.py

示例6: processEventsTasklet

# 需要导入模块: from psychopy.iohub import Computer [as 别名]
# 或者: from psychopy.iohub.Computer import getTime [as 别名]
 def processEventsTasklet(self,sleep_interval):
     while self._running:
         stime=Computer.getTime()
         self.processDeviceEvents()
         dur = sleep_interval - (Computer.getTime()-stime)
         gevent.sleep(max(0.0, dur))
开发者ID:NSalem,项目名称:psychopy,代码行数:8,代码来源:server.py

示例7: getTime

# 需要导入模块: from psychopy.iohub import Computer [as 别名]
# 或者: from psychopy.iohub.Computer import getTime [as 别名]
 def getTime(self):
     """
     See Computer.getTime documentation, where current process will be
     the ioHub Server process.
     """
     return Computer.getTime()
开发者ID:NSalem,项目名称:psychopy,代码行数:8,代码来源:server.py


注:本文中的psychopy.iohub.Computer.getTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。