本文整理汇总了Python中menu.Menu.select_menu_item方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.select_menu_item方法的具体用法?Python Menu.select_menu_item怎么用?Python Menu.select_menu_item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类menu.Menu
的用法示例。
在下文中一共展示了Menu.select_menu_item方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: quit_game
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select_menu_item [as 别名]
def quit_game():
quit_items=Menu([
MenuItem(1, "Save and Quit", save_and_quit),
MenuItem(2, "Quit without save", quit_without_save),
MenuItem(3, "Resume", resume)])
quit_items.print_menu_items()
quit_item=quit_items.select_menu_item()
示例2: potion_submenu
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select_menu_item [as 别名]
def potion_submenu():
potion_submenu_items=Menu([
MenuItem(1, "Reselect the Potion", select_potion),
MenuItem(2, "Continue", print_character),
MenuItem(3, "Quit", quit_game)])
potion_submenu_items.print_menu_items()
potion_submenu_item=potion_submenu_items.select_menu_item()
示例3: after_strike_menu
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select_menu_item [as 别名]
def after_strike_menu():
after_strike_items=Menu([
MenuItem(1, "Continue", after_strike),
MenuItem(2, "Try your Luck", try_luck),
MenuItem(3, "Retreat", retreat),
MenuItem(4, "Quit", quit_game)])
after_strike_items.print_menu_items()
after_strike_item=after_strike_items.select_menu_item()
示例4: print_character
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select_menu_item [as 别名]
def print_character():
print(user.get_character())
print_submenu_items=Menu([
MenuItem(1, "Begin", begin),
MenuItem(2, "Save", save_game),
MenuItem(3, "Quit", quit_game)])
print_submenu_items.print_menu_items()
print_submenu_item=print_submenu_items.select_menu_item()
示例5: select_potion
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select_menu_item [as 别名]
def select_potion():
print(" ")
print("Select potion:")
select_potion_items=Menu([
MenuItem(1, "Potion of Health", potion_of_health),
MenuItem(2, "Potion of Dexterity", potion_of_dexterity),
MenuItem(3, "Potion of Luck", potion_of_luck)])
select_potion_items.print_menu_items()
select_potion_item=select_potion_items.select_menu_item()
示例6: new_game
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select_menu_item [as 别名]
def new_game():
user.name=input('What is your name? ')
print('Your name is: '+ user.name)
submenu_items=Menu([
MenuItem(1, "Reenter name", reenter_name),
MenuItem(2, "Continue", roll_stat_game),
MenuItem(3, "Save", save_game),
MenuItem(4, "Quit", quit_game)])
submenu_items.print_menu_items()
sub_item=submenu_items.select_menu_item()
示例7: begin
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select_menu_item [as 别名]
def begin():
print(("-*")*30)
print("Test your Sword in a test fight")
print(user.begin_character())
print(monster.monster_status())
begin_submenu_items=Menu([
MenuItem(1, "Strike", strike),
MenuItem(2, "Retreat", begin),
MenuItem(3, "Quit", quit_game)])
begin_submenu_items.print_menu_items()
begin_submenu_item=begin_submenu_items.select_menu_item()
示例8: roll_stat_game
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select_menu_item [as 别名]
def roll_stat_game():
user.get_dexterity()
user.get_luck()
user.get_health()
roll_stat_items=Menu([
MenuItem(1, "Reroll stats", roll_stat_game),
MenuItem(2, "Continue", select_potion),
MenuItem(3, "Save", save_game),
MenuItem(4, "Quit", quit_game)])
roll_stat_items.print_menu_items()
roll_stat_item=roll_stat_items.select_menu_item()
示例9: MenuItem
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import select_menu_item [as 别名]
MenuItem(2, "Quit without save", quit_without_save),
MenuItem(3, "Resume", resume)])
quit_items.print_menu_items()
quit_item=quit_items.select_menu_item()
def new_game():
user.name=input('What is your name? ')
print('Your name is: '+ user.name)
submenu_items=Menu([
MenuItem(1, "Reenter name", reenter_name),
MenuItem(2, "Continue", roll_stat_game),
MenuItem(3, "Save", save_game),
MenuItem(4, "Quit", quit_game)])
submenu_items.print_menu_items()
sub_item=submenu_items.select_menu_item()
def load_game():
print('kaki ez a load game')
pass
def exit():
pass
main_items=Menu([
MenuItem(1, "New game", new_game),
MenuItem(2, "Load game", load_game),
MenuItem(3, "Exit", exit)])
main_items.print_menu_items()
item=main_items.select_menu_item()