Utils¶
This module regroup different utility functions and constants.
-
gamelib.Utils.
black
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
black_bright
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
black_dim
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
blue
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
blue_bright
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
blue_dim
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
clear_screen
()¶ This methods clear the screen
-
gamelib.Utils.
cyan
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
cyan_bright
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
cyan_dim
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
debug
(message)¶ Print a debug message.
The debug message is a regular message prefixed by INFO in blue on a green background.
Parameters: message (str) – The message to print. Example:
Utils.debug("This is probably going to success, eventually...")
-
gamelib.Utils.
fatal
(message)¶ Print a fatal message.
The fatal message is a regular message prefixed by FATAL in white on a red background.
Parameters: message (str) – The message to print. Example:
Utils.fatal("|x_x|")
-
gamelib.Utils.
get_key
()¶ Reads the next key-stroke returning it as a string.
Example:
key = Utils.get_key() if key == Utils.key.UP: print("Up") elif key == "q" exit()
Note
See readkey documentation in readchar package.
-
gamelib.Utils.
green
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
green_bright
(message)¶ Return a string formatted to be bright green
Parameters: message (str) – The message to format. Returns: The formatted string Return type: str Example:
print( Utils.green_bright("This is a formatted message") )
-
gamelib.Utils.
green_dim
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
info
(message)¶ Print an informative message.
The info is a regular message prefixed by INFO in white on a blue background.
Parameters: message (str) – The message to print. Example:
Utils.info("This is a very informative message.")
-
gamelib.Utils.
init_term_colors
()¶ This function is a forward to colorama.init()
-
gamelib.Utils.
magenta
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
magenta_bright
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
magenta_dim
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
print_white_on_red
(message)¶ Print a white message over a red background.
Parameters: message (str) – The message to print. Example:
Utils.print_white_on_red("This is bright!")
-
gamelib.Utils.
red
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
red_bright
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
red_dim
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
warn
(message)¶ Print a warning message.
The warning is a regular message prefixed by WARNING in black on a yellow background.
Parameters: message (str) – The message to print. Example:
Utils.warn("This is a warning.")
-
gamelib.Utils.
white
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
white_bright
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
white_dim
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
yellow
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
yellow_bright
(message)¶ This method works exactly the way green_bright() work with different color.
-
gamelib.Utils.
yellow_dim
(message)¶ This method works exactly the way green_bright() work with different color.