pygamelib.base.Text

class pygamelib.base.Text(text='', fg_color='', bg_color='', style='')

An object to manipulate and display text in multiple contexts.

New in version 1.2.0.

The Text class is a collection of text formating and display static methods.

You can either instantiate an object or use the static methods.

The Text object allow for easy text manipulation through its collection of independent attributes. They help to set the text, its style and the foreground and background colors.

The Text object can generate a Sprite to represent itself. This is particularly useful to the place text on the game Board.

Parameters:
  • text (str) – The text to manipulate
  • fg_color (str) – The foreground color for the text.
  • bg_color (str) – The background color for the text.
  • style (str) – The style for the text.
__init__(text='', fg_color='', bg_color='', style='')

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([text, fg_color, bg_color, style]) Initialize self.
black(message) This method works exactly the way green_bright() work with different color.
black_bright(message) This method works exactly the way green_bright() work with different color.
black_dim(message) This method works exactly the way green_bright() work with different color.
blue(message) This method works exactly the way green_bright() work with different color.
blue_bright(message) This method works exactly the way green_bright() work with different color.
blue_dim(message) This method works exactly the way green_bright() work with different color.
cyan(message) This method works exactly the way green_bright() work with different color.
cyan_bright(message) This method works exactly the way green_bright() work with different color.
cyan_dim(message) This method works exactly the way green_bright() work with different color.
debug(message) Print a debug message.
fatal(message) Print a fatal message.
green(message) This method works exactly the way green_bright() work with different color.
green_bright(message) Return a string formatted to be bright green
green_dim(message) This method works exactly the way green_bright() work with different color.
info(message) Print an informative message.
magenta(message) This method works exactly the way green_bright() work with different color.
magenta_bright(message) This method works exactly the way green_bright() work with different color.
magenta_dim(message) This method works exactly the way green_bright() work with different color.
print_white_on_red(message) Print a white message over a red background.
red(message) This method works exactly the way green_bright() work with different color.
red_bright(message) This method works exactly the way green_bright() work with different color.
red_dim(message) This method works exactly the way green_bright() work with different color.
warn(message) Print a warning message.
white(message) This method works exactly the way green_bright() work with different color.
white_bright(message) This method works exactly the way green_bright() work with different color.
white_dim(message) This method works exactly the way green_bright() work with different color.
yellow(message) This method works exactly the way green_bright() work with different color.
yellow_bright(message) This method works exactly the way green_bright() work with different color.
yellow_dim(message) This method works exactly the way green_bright() work with different color.