Adding colors, also renamed loader to game
This commit is contained in:
parent
43aad028d7
commit
b9f7abb29e
3 changed files with 12 additions and 2 deletions
|
@ -1,7 +1,9 @@
|
|||
from sys import argv
|
||||
from loader import *
|
||||
from game import *
|
||||
from colorama import init
|
||||
|
||||
def main():
|
||||
init()
|
||||
if len(argv)<2:
|
||||
print("You need to specify a path to a YAML file")
|
||||
exit(1)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import yaml
|
||||
from yaml.loader import SafeLoader
|
||||
from colorama import Fore, Back, Style
|
||||
|
||||
class Game:
|
||||
def __init__(self,name:str,author:str,game:dict):
|
||||
|
@ -36,6 +37,12 @@ class Game:
|
|||
isWrong = self.make_selection(sel)
|
||||
self.printme()
|
||||
|
||||
def parse_colors(self,text:str) -> str:
|
||||
'''
|
||||
Used to convert color codes in string to colors from the colorama lib
|
||||
'''
|
||||
return text.replace("&b",Fore.CYAN)
|
||||
|
||||
|
||||
def load(file_path):
|
||||
'''Loads the game from a YAML file to a Game class'''
|
|
@ -1 +1,2 @@
|
|||
pyyaml==6.0
|
||||
pyyaml==6.0
|
||||
colorama==0.4.4
|
Reference in a new issue