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


Python Menu.print_menu方法代码示例

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


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

示例1: strike_menu

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import print_menu [as 别名]
def strike_menu():
    roll_cube(player)
    roll_cube(opponent)

    if player.roll > opponent.roll:
        print(player)
        print(opponent)
        print('You hits monster')
        opponent.hp -= 2
        print(player)
        print(opponent)

    else:
        print(player)
        print(opponent)
        print('Monster hits you')
        player.hp -= 2
        print(player)
        print(opponent)

    name_items = Menu([
            MenuItem(1, 'Try your luck', try_your_luck_menu),
            MenuItem(2, 'Retreat', strike_menu),
            MenuItem(3, 'Quit', quit),
            ])
    name_items.print_menu()
    name_items.choose()
开发者ID:greenfox-academy,项目名称:peterjuhasz,代码行数:29,代码来源:main_menu.py

示例2: sub_m

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import print_menu [as 别名]
def sub_m():
    main_items = Menu([
            MenuItem(1, 'sub item1', new_game),
            MenuItem(2, 'sub item1', load),
            MenuItem(0, 'sub item1', save_and_exit)
            ])
    main_items.print_menu()
    main_items.choose()
开发者ID:greenfox-academy,项目名称:peterjuhasz,代码行数:10,代码来源:sub_menu.py

示例3: main

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import print_menu [as 别名]
def main():
    main_items = Menu([
            MenuItem(1, 'New Game', name_m),
            MenuItem(2, 'Load Game', load),
            MenuItem(3, 'Save and Exit', save_and_exit)
            ])
    main_items.print_menu()
    main_items.choose()
开发者ID:greenfox-academy,项目名称:peterjuhasz,代码行数:10,代码来源:main_menu.py

示例4: potion_select_menu

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import print_menu [as 别名]
def potion_select_menu():

    name_items = Menu([
            MenuItem(1, 'Potion of Health', lambda: potion_menu(1)),
            MenuItem(2, 'Potion of Dexterity', lambda: potion_menu(2)),
            MenuItem(3, 'Potion of Luck', lambda: potion_menu(3)),
            ])
    name_items.print_menu()
    name_items.choose()
开发者ID:greenfox-academy,项目名称:peterjuhasz,代码行数:11,代码来源:main_menu.py

示例5: roll_stat_menu

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import print_menu [as 别名]
def roll_stat_menu():
    roll_stat(player)
    name_items = Menu([
            MenuItem(1, 'reroll_stat', roll_stat_menu),
            MenuItem(2, 'Continue', potion_select_menu),
            MenuItem(3, 'Save', save),
            MenuItem(4, 'Quit', save)
            ])
    name_items.print_menu()
    name_items.choose()
开发者ID:greenfox-academy,项目名称:peterjuhasz,代码行数:12,代码来源:main_menu.py

示例6: name_m

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import print_menu [as 别名]
def name_m():
    new_game()
    name_items = Menu([
            MenuItem(1, 'Reenter name', name_m),
            MenuItem(2, 'Continue', roll_stat_menu),
            MenuItem(3, 'Save', save),
            MenuItem(4, 'Quit', quit)
            ])
    name_items.print_menu()
    name_items.choose()
开发者ID:greenfox-academy,项目名称:peterjuhasz,代码行数:12,代码来源:main_menu.py

示例7: fight_menu

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import print_menu [as 别名]
def fight_menu():
    print("Test your Sword in a test fight")
    print(player)
    print(opponent)
    name_items = Menu([
            MenuItem(1, 'Strike', strike_menu),
            MenuItem(2, 'Retreat', save),
            MenuItem(3, 'Quit', quit),
            ])
    name_items.print_menu()
    name_items.choose()
开发者ID:greenfox-academy,项目名称:peterjuhasz,代码行数:13,代码来源:main_menu.py

示例8: begin_menu

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import print_menu [as 别名]
def begin_menu():
    print(player)
    roll_stat(opponent)

    name_items = Menu([
            MenuItem(1, 'Begin', fight_menu),
            MenuItem(2, 'Save', save),
            MenuItem(3, 'Quit', quit),
            ])
    name_items.print_menu()
    name_items.choose()
开发者ID:greenfox-academy,项目名称:peterjuhasz,代码行数:13,代码来源:main_menu.py

示例9: potion_menu

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import print_menu [as 别名]
def potion_menu(selection):
    print() #empty line
    if selection == 1: print('choosed pitoion: Potion of Health')
    elif selection == 2: print('choosed pitoion: Potion of Dexterity')
    elif selection == 3: print('choosed pitoion: Potion of Luck')
    else: print('else ag')

    name_items = Menu([
            MenuItem(1, 'Reselect the Potion', potion_select_menu),
            MenuItem(2, 'Continue', begin_menu),
            MenuItem(3, 'Quit', quit),
            ])
    name_items.print_menu()
    name_items.choose()
开发者ID:greenfox-academy,项目名称:peterjuhasz,代码行数:16,代码来源:main_menu.py


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