本文整理匯總了Python中forms.Form.run方法的典型用法代碼示例。如果您正苦於以下問題:Python Form.run方法的具體用法?Python Form.run怎麽用?Python Form.run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類forms.Form
的用法示例。
在下文中一共展示了Form.run方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: disproveAccusation
# 需要導入模塊: from forms import Form [as 別名]
# 或者: from forms.Form import run [as 別名]
#.........這裏部分代碼省略.........
tracker = []
character_menu = Select(border_width=2, top=50)
character_list = card_deck.get_cardlist("character")
char_found = False
for character_name in character_list:
if card_names_to_limit and len(card_names_to_limit) > 1 and character_name in card_names_to_limit:
character_menu.add_option(character_name,character_name)
tracker.append(character_name)
char_found = True
elif card_names_to_limit and len(card_names_to_limit) == 1:
character_menu.add_option(character_name,character_name)
tracker.append(character_name)
char_found = True
elif not card_names_to_limit:
character_menu.add_option(character_name,character_name)
tracker.append(character_name)
char_found = True
if char_found:
accusation_form.add_object('title_character', Text('Select Character:', label_style=['bold']))
accusation_form.add_object('character', character_menu)
else:
accusation_form.add_object('title_character', Text('Select Character:', label_style=['bold']))
accusation_form.add_object('title_character_1', Text('Sorry, no Character cards', label_style=['bold']))
accusation_form.add_object('title_character_2', Text('in your deck to select', label_style=['bold']))
#if disproving: accusation_form.add_object('weapon_title', Text('with a', label_style=['bold']))
weapon_list = card_deck.get_cardlist("weapon")
weapon_menu = Select(border_width=2, top=50)
weapon_found = False
for weapon_name in weapon_list:
if card_names_to_limit and len(card_names_to_limit) > 1 and weapon_name in card_names_to_limit:
weapon_menu.add_option(weapon_name,weapon_name)
tracker.append(weapon_name)
weapon_found = True
elif card_names_to_limit and len(card_names_to_limit) == 1:
weapon_menu.add_option(weapon_name,weapon_name)
tracker.append(weapon_name)
weapon_found = True
elif not card_names_to_limit:
weapon_menu.add_option(weapon_name,weapon_name)
tracker.append(weapon_name)
weapon_found = True
if weapon_found:
accusation_form.add_object('title_weapon', Text('Select Weapon:', label_style=['bold']))
accusation_form.add_object('weapon', weapon_menu)
else:
accusation_form.add_object('title_weapon', Text('Select Weapon:', label_style=['bold']))
accusation_form.add_object('title_weapon_1', Text('Sorry, no Weapon cards', label_style=['bold']))
accusation_form.add_object('title_weapon_2', Text('in your deck to select', label_style=['bold']))
#if disproving: accusation_form.add_object('room_title', Text('in the', label_style=['bold']))
room_list = card_deck.get_cardlist("room")
room_menu = Select(border_width=2, top=50)
room_found = False
for room_name in room_list:
if card_names_to_limit and room_name in card_names_to_limit:
room_menu.add_option(room_name,room_name)
tracker.append(room_name)
room_found = True
elif not card_names_to_limit:
room_menu.add_option(room_name,room_name)
tracker.append(room_name)
room_found = True
if room_found:
accusation_form.add_object('title_room', Text('Select Room:', label_style=['bold']))
accusation_form.add_object('room', room_menu)
else:
accusation_form.add_object('title_room', Text('Select Room:', label_style=['bold']))
accusation_form.add_object('title_room_1', Text('Sorry, no Room cards', label_style=['bold']))
accusation_form.add_object('title_room_2', Text('in your deck to select', label_style=['bold']))
if disproving:
accusation_form.add_object('submit', Button('Disprove', accusation_form.submit, ()))
accusation_form.add_object('skip', Button('Skip', accusation_form.skip, ()))
else:
if message_type == "New Suggestion":
accusation_form.add_object('submit', Button('Make Suggestion', accusation_form.submit, ()))
else:
accusation_form.add_object('submit', Button('Make Final Accusation', accusation_form.submit, ()))
accusation_form.add_object('skip', Button('Skip', accusation_form.skip, ()))
accusation_form.add_object('Clear', Button('Clear', accusation_form.clear, ()))
form_input = accusation_form.run(screen)
if accusation_form._skip:
return {}
elif disproving and len(form_input) == 0:
return None
elif not disproving and len(form_input) != 3:
return None
return form_input