本文整理汇总了Python中director.timercallback.TimerCallback.callback方法的典型用法代码示例。如果您正苦于以下问题:Python TimerCallback.callback方法的具体用法?Python TimerCallback.callback怎么用?Python TimerCallback.callback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类director.timercallback.TimerCallback
的用法示例。
在下文中一共展示了TimerCallback.callback方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: startApplication
# 需要导入模块: from director.timercallback import TimerCallback [as 别名]
# 或者: from director.timercallback.TimerCallback import callback [as 别名]
def startApplication(enableQuitTimer=False):
appInstance = QtGui.QApplication.instance()
if enableQuitTimer:
quitTimer = TimerCallback()
quitTimer.callback = appInstance.quit
quitTimer.singleShot(0.1)
appInstance.exec_()
示例2: main
# 需要导入模块: from director.timercallback import TimerCallback [as 别名]
# 或者: from director.timercallback.TimerCallback import callback [as 别名]
def main():
app = consoleapp.ConsoleApp()
meshCollection = lcmobjectcollection.LCMObjectCollection('MESH_COLLECTION_COMMAND')
affordanceCollection = lcmobjectcollection.LCMObjectCollection('AFFORDANCE_COLLECTION_COMMAND')
meshCollection.sendEchoRequest()
affordanceCollection.sendEchoRequest()
def printCollection():
print
print '----------------------------------------------------'
print datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print '%d affordances' % len(affordanceCollection.collection)
for desc in affordanceCollection.collection.values():
print
print 'name:', desc['Name']
print 'type:', desc['classname']
timer = TimerCallback(targetFps=0.2)
timer.callback = printCollection
timer.start()
#app.showPythonConsole()
app.start()
示例3: startQuitTimer
# 需要导入模块: from director.timercallback import TimerCallback [as 别名]
# 或者: from director.timercallback.TimerCallback import callback [as 别名]
def startQuitTimer(timeoutInSeconds):
quitTimer = TimerCallback()
quitTimer.callback = ConsoleApp.quit
quitTimer.singleShot(timeoutInSeconds)
示例4: spawnBasicLabel
# 需要导入模块: from director.timercallback import TimerCallback [as 别名]
# 或者: from director.timercallback.TimerCallback import callback [as 别名]
ql.setMinimum(min)
ql.setOrientation(QtCore.Qt.Vertical)
return ql
statusLabel = spawnBasicLabel()
l.addWidget(wrapInVTitledItem("Behavior", [statusLabel]))
def statusUpdate():
behavior = atlasDriver.getCurrentBehaviorName()
statusLabel.setText(behavior)
if (behavior != "user"):
statusLabel.setStyleSheet(LABEL_DEFAULT_STYLE_SHEET + "background-color:red; color:white")
else:
statusLabel.setStyleSheet(LABEL_DEFAULT_STYLE_SHEET + "background-color:white; color:black")
statusTimer = TimerCallback(targetFps=FPS)
statusTimer.callback = statusUpdate
statusTimer.start()
controllerLabel = spawnBasicLabel()
l.addWidget(wrapInVTitledItem("Controller", [controllerLabel]))
def controllerUpdate():
status = atlasDriver.getControllerStatus()
if not status:
status = "Unknown"
if len(status) > 6:
status = status[0:6]
rate = atlasDriver.getControllerRate()
if not rate:
rate = 0.0
controllerLabel.setText("%s\n%06.1fhz" % (status, rate))
if (rate < 500):
示例5: TimerCallback
# 需要导入模块: from director.timercallback import TimerCallback [as 别名]
# 或者: from director.timercallback.TimerCallback import callback [as 别名]
#########################
numRays = 20
rayLength = 5
angleMin = -np.pi/2
angleMax = np.pi/2
angleGrid = np.linspace(angleMin, angleMax, numRays)
rays = np.zeros((3,numRays))
rays[0,:] = np.cos(angleGrid)
rays[1,:] = np.sin(angleGrid)
timer = TimerCallback(targetFps=30)
timer.callback = tick
playTimer = TimerCallback(targetFps=30)
playTimer.callback = tick3
app = ConsoleApp()
view = app.createView()
panel = QtGui.QWidget()