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


Python Dialog.load方法代码示例

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


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

示例1: int

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import load [as 别名]
    if movement_way == "straight":
        scope.way = "forward"
    elif movement_way == "back":
        scope.way = "backward"
    else:
        responses.put("failed")
        scope._exit = True
    scope.move_time = int(scope.move_time)
    scope.distance = scope.move_time
    scope.position = 0

def after(scope, responses):
    scope.channel.send(None)
    if scope.channel.receive() == "success":
        pass

@handle(callbacks, before=before, after=after)
def movement(requests, responses, scope):
    if not scope.stopped:
        print(scope.position)
        scope.channel.send(scope.way)
        scope.position += 0.1
        time.sleep(0.1)
        if scope.position >= scope.distance:
            responses.put("finished")
            scope._exit = True

if __name__ == "__main__":
    DLG = Dialog(globals())
    DLG.load("control.dlg")
    DLG.start()
开发者ID:kusha,项目名称:dialog,代码行数:33,代码来源:main.py

示例2: greetings

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import load [as 别名]
import datetime

def greetings():
    return "Hello " + collocutor

name = "PR2"

def get_time():
    now = datetime.datetime.now()
    return str(now.hour) + ' ' + str(now.minute)

def is_angry():
    try:
        if angry == True: 
            return "You are angry"
        else:
            return "You aren't angry"
    except NameError:
        return "i don't know"

def day_of_week():
    days = ['Mon','Tues','Wednes','Thurs','Fri','Satur','Sun']
    return days[datetime.datetime.now().weekday()] + 'day'


if __name__ == "__main__":
    DLG = Dialog(globals(), debug=True)
    DLG.load("examples/tickets.dlg")
    DLG.interprete()
开发者ID:kusha,项目名称:but_robot_demos,代码行数:31,代码来源:main.py

示例3: after

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import load [as 别名]
    scope.step = 7

def after(scope, responses):
    pass
     
@handle(callbacks, before=before, after=after)
def count(requests, responses, scope):
    if not scope.stop_flag:
        time.sleep(2)
        scope.value += scope.step
        print("Rtn>\t", scope.value)
        if scope.value == 21:
            print('HALF')
            responses.put("half")
        elif scope.value == 42:
            responses.put("finished")
            scope._exit = True
        elif scope.value == 0:
            responses.put("reverted")
            scope._exit = True
        # print("*my pos is %s*" % scope.pos)
    else:
        time.sleep(2)
        # print("*do nothing*")

# Running a dialog system
if __name__ == "__main__":
    DLG = Dialog(globals())
    DLG.load("examples/features_demo/demo.dlg")
    DLG.start()
开发者ID:kusha,项目名称:dialog,代码行数:32,代码来源:main.py


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