Console

class pygamelib.base.Console

Bases: object

The Console class is a singleton wrapper around the blessed.Terminal() class. Since the library is using Terminal a lot, it is both useful and efficient to have a quick access to a single instance of the class.

This class only expose one method: instance() that returns the singleton instance.

Methods

instance()

Returns the instance of the blessed.Terminal object.

classmethod instance()

Returns the instance of the blessed.Terminal object.

New in version 1.3.0.

The pygamelib extensively use the Terminal object from the blessed module. However we find ourselves in need of a Terminal instance a lot, so to help with memory and execution time we just encapsulate the Terminal object in a singleton so any object can use it without instantiating it many times (and messing up with the contexts).

Returns:

Instance of blessed.Terminal object

Example:

term = Console.instance()