async def start(): console.clear() styledprint.styled_print(config['application_name'].upper(), color=styledprint.Color.MAGENTA, attrs=[styledprint.Attribute.BOLD]) await menu()
async def run_option(number_option: int): option = None with suppress(Exception): option = options[number_option - 1] if option is not None: console.clear() await option.run()
def generate_command(rank): unit_list = units.create_unit_list(rank) random1 = random.randint(0, len(unit_list) - 1) random2 = random.randint(0, len(unit_list[random1].actions) - 1) target = unit_list[random1].actions[random2] console.clear(.05) return (unit_list[random1].verb, target["Command"], target["Key"])
def __print(self): console.clear() # custom items print(f'-------{self.__currentNode.title}------- ' + self.__error) for i in range(len(self.__currentNode.childs)): if i == self.__currentPos - 1: console.printBold(f'[{self.__currentNode.childs[i].title}]') else: print(f'[{self.__currentNode.childs[i].title}]')
def run(self, *args): self.__currentNode = self.root exit_str = "EXIT" if len(args) > 0 and isinstance(args[0], str): exit_str = args[0] if not (len(args) > 0 and isinstance(args[0], bool) and args[0] is False): self.__currentNode.append(exit_str, lambda: self.__setBreakStatus(False)) while (self.__isBreakON): self.__print() self.__stepController(self.__inputController()) console.clear()
from utils import terminal import time from models.player import Player from models.level import Level #resources title = open('./resources/title.txt').read() training = open('./resources/training.txt').read() # LOAD counter = 25 while counter < 100: counter += 1 print("loading " + str(counter) + '%') print('=' * counter) console.clear(.02) # TITLE print(title) console.clear(1) # USER user = None waiting = True while waiting: print(""" Game Options 1. Use default name 2. Use custom name """)