tamcolors.tam_io package

Submodules

tamcolors.tam_io.ansi_256_drivers module

class tamcolors.tam_io.ansi_256_drivers.ANSI256ChangerDriver(*args, **kwargs)

Bases: tamcolors.tam_io.tam_drivers.ColorChangerDriver, abc.ABC

class tamcolors.tam_io.ansi_256_drivers.ANSI256ColorDriver(*args, **kwargs)

Bases: tamcolors.tam_io.tam_drivers.FullColorDriver, abc.ABC

draw(tam_buffer)

info: Will draw TAMBuffer to console :param tam_buffer: TAMBuffer :return: None

get_printc_mode()

Gets the modes used by printc and inputc :return: str

inputc(output, color)

info: Will get input from the console in color :param output: str :param color: COLOR :return: str

printc(output, color, flush, stderr)

info: Will print to the console in color :param output: str :param color: COLOR :param flush: bool :param stderr: std :return:

set_mode(mode)

info: will set the color mode :param mode: int: key to color mode :return:

start()

info: operations for IO to start :return: None

tamcolors.tam_io.ansi_true_color_drivers module

class tamcolors.tam_io.ansi_true_color_drivers.ANSITrueFullColorDriver(*args, **kwargs)

Bases: tamcolors.tam_io.tam_drivers.FullColorDriver, abc.ABC

draw(tam_buffer)

info: Will draw TAMBuffer to console :param tam_buffer: TAMBuffer :return: None

get_printc_mode()

Gets the modes used by printc and inputc :return: str

inputc(output, color)

info: Will get input from the console in color :param output: str :param color: COLOR :return: str

printc(output, color, flush, stderr)

info: Will print to the console in color :param output: str :param color: COLOR :param flush: bool :param stderr: std :return:

set_mode(mode)

info: will set the color mode :param mode: int: key to color mode :return:

start()

info: operations for IO to start :return: None

tamcolors.tam_io.any_drivers module

class tamcolors.tam_io.any_drivers.ANYColorChangerDriver(*args, **kwargs)

Bases: tamcolors.tam_io.tam_drivers.ColorChangerDriver, abc.ABC

class tamcolors.tam_io.any_drivers.ANYColorDriver(*args, **kwargs)

Bases: tamcolors.tam_io.tam_drivers.ColorDriver, abc.ABC

draw(tam_buffer)

info: Will draw TAMBuffer to console :param tam_buffer: TAMBuffer :return: None

get_printc_mode()

Gets the modes used by printc and inputc :return: str

inputc(value, color)

info: will get user input with color :param value: str :param color: tuple: (int, int) :return: str

printc(output, color, flush, stderr)

info: will print out user output with color :param output: str :param color: tuple: (int, int) :param flush: boolean :param stderr: boolean :return: None

class tamcolors.tam_io.any_drivers.ANYKeyDriver(*args, **kwargs)

Bases: tamcolors.tam_io.tam_drivers.KeyDriver, abc.ABC

get_key()

info: Gets an input from the terminal :return: tuple or false

static get_key_dict()

info: Gets a dict of all the keys :return: {str: (str, str), …}

class tamcolors.tam_io.any_drivers.ANYUtilitiesDriver(*args, **kwargs)

Bases: tamcolors.tam_io.tam_drivers.UtilitiesDriver, abc.ABC

clear()

info: Will clear the console :return: None

get_dimensions()

info: Gets the dimensions of console :return: (int, int): (row, column)

show_console_cursor(show)

info: Will show or hide console cursor :param show: int :return: None

tamcolors.tam_io.io_tam module

class tamcolors.tam_io.io_tam.IO(identifier, mode_2=True, mode_16_pal_256=True, mode_16=True, mode_256=True, mode_rgb=True, key_driver_operational=True, color_driver_operational=True, color_changer_driver_operational=True, utilities_driver_operational=True)

Bases: tamcolors.tam_io.io_tam.RawIO, abc.ABC

classmethod able_to_execute()

info: checks that io is stable in current environment :return: bool

clear()

info: Will clear the console :return: None

color_changer_driver_operational()

info: checks if the color changer driver is operational :return: bool

color_driver_operational()

info: checks if the color driver is operational :return: bool

done()

info: operations for IO to stop :return: None

draw(tam_buffer)

info: Will draw TAMBuffer to console :param tam_buffer: TAMBuffer :return: None

enable_console_keys(enable)

info: will enable console keys :param enable: boool :return: None

get_color_16(spot)

info: Will get color from color palette 16 :param spot: int :return: RGBA

get_color_16_pal_256(spot)

info: Will get color from color palette 2 :param spot: int :return: int

get_color_2(spot)

info: Will get color from color palette 2 :param spot: int :return: RGBA

get_color_256(spot)

info: Will get color from color palette 256 :param spot: int :return: RGBA

get_dimensions()

info: Gets the dimensions of console :return: (int, int): (row, column)

get_info_dict()

info: will get the identifier dict :return: dict

get_key()

info: Gets an input from the terminal :return: tuple or false

static get_key_dict()

info: Gets a dict of all the keys :return: {str: (str, str), …}

get_mode()

info: will return the current color mode :return: int

get_modes()

info: will return a tuple of all color modes :return: (int, int, …)

get_printc_mode()

Gets the modes used by printc and inputc :return: str

inputc(output, color)

info: Will get input from the console in color :param output: str :param color: COLOR :return: str

is_console_cursor_enabled()

info: will check if console cursor is enabled :return: bool

is_console_keys_enabled()

info: will check if console keys enabled :return: bool

key_driver_operational()

info: checks if the key driver is operational :return: bool

printc(output, color, flush, stderr)

info: Will print to the console in color :param output: str :param color: COLOR :param flush: bool :param stderr: std :return:

reset_colors_to_console_defaults()

info: will reset colors to console defaults :return: None

set_color_16(spot, color)

info: sets a color value :param spot: int :param color: RGBA :return: None

set_color_16_pal_256(spot, color)

info: sets a color value :param spot: int :param color: int :return: None

set_color_2(spot, color)

info: sets a color value :param spot: int :param color: RGBA :return: None

set_color_256(spot, color)

info: sets a color value :param spot: int :param color: RGBA :return: None

set_mode(mode)

info: will set the color mode :param mode: int: key to color mode :return: None

set_tam_color_defaults()

info: will set console colors to tam defaults :return: None

show_console_cursor(show)

info: Will show or hide console cursor :param show: bool :return: None

start()

info: operations for IO to start :return: None

utilities_driver_operational()

info: checks if the utilities driver is operational :return: bool

class tamcolors.tam_io.io_tam.RawIO

Bases: abc.ABC

classmethod able_to_execute()

info: checks that io is stable in current environment :return: bool

clear()

info: Will clear the console :return: None

color_change_driver_operational()

info: checks if the color changer driver is operational :return: bool

color_changer_driver_operational()

info: checks if the color changer driver is operational :return: bool

color_driver_operational()

info: checks if the color driver is operational :return: bool

done()

info: operations for IO to stop :return: None

draw(tam_buffer)

info: Will draw TAMBuffer to console :param tam_buffer: TAMBuffer :return: None

enable_console_keys(enable)

info: will enable console keys :param enable: boool :return: None

get_color_16(spot)

info: Will get color from color palette 16 :param spot: int :return: RGBA

get_color_16_pal_256(spot)

info: Will get color from color palette 2 :param spot: int :return: int

get_color_2(spot)

info: Will get color from color palette 2 :param spot: int :return: RGBA

get_color_256(spot)

info: Will get color from color palette 256 :param spot: int :return: RGBA

get_dimensions()

info: Gets the dimensions of console :return: (int, int): (row, column)

get_info_dict()

info: will get the identifier dict :return: dict

get_key()

info: Gets an input from the terminal :return: tuple or false

static get_key_dict()

info: Gets a dict of all the keys :return: {str: (str, str), …}

get_mode()

info: will return the current color mode :return: int

get_modes()

info: will return a tuple of all color modes :return: (str, str, …)

get_printc_mode()

Gets the modes used by printc and inputc :return: str

inputc(output, color)

info: Will get input from the console in color :param output: str :param color: COLOR :return: str

is_console_cursor_enabled()

info: will check if console cursor is enabled :return: bool

is_console_keys_enabled()

info: will check if console keys enabled :return: bool

key_driver_operational()

info: checks if the key driver is operational :return: bool

printc(output, color, flush, stderr)

info: Will print to the console in color :param output: str :param color: COLOR :param flush: bool :param stderr: std :return:

reset_colors_to_console_defaults()

info: will reset colors to console defaults :return: None

set_color_16(spot, color)

info: sets a color value :param spot: int :param color: RGBA :return: None

set_color_16_pal_256(spot, color)

info: sets a color value :param spot: int :param color: int :return: None

set_color_2(spot, color)

info: sets a color value :param spot: int :param color: RGBA :return: None

set_color_256(spot, color)

info: sets a color value :param spot: int :param color: RGBA :return: None

set_mode(mode)

info: will set the color mode :param mode: int: key to color mode :return:

set_tam_color_defaults()

info: will set console colors to tam defaults :return: None

show_console_cursor(show)

info: Will show or hide console cursor :param show: int :return: None

start()

info: operations for IO to start :return: None

utilities_driver_operational()

info: checks if the utilities driver is operational :return: bool

tamcolors.tam_io.tam_buffer module

class tamcolors.tam_io.tam_buffer.TAMBuffer(width, height, char, foreground_color, background_color)

Bases: tamcolors.utils.object_packer.FastHandObjectPacker

clear()

info: clears TAMBuffer :return:

copy()

info: copy’s TAMBuffer :return: TAMBuffer

draw_onto(tam_buffer, start_x=0, start_y=0, buffer_start_x=0, buffer_start_y=0, buffer_size_x=-1, buffer_size_y=-1, override_alpha=False)

info: will draw tam_buffer or part of a TAMBuffer onto another TAMBuffer :param tam_buffer: TAMBuffer :param start_x: int :param start_y: int :param buffer_start_x: int :param buffer_start_y: int :param buffer_size_x: int: 0 - inf :param buffer_size_y: int: 0 - inf :param override_alpha: bool :return:

classmethod from_bytes(object_byte_array)

info: from bytes to object :param object_byte_array: bytearray :return: object

get_cross_rect(tam_buffer, start_x=0, start_y=0, buffer_start_x=0, buffer_start_y=0, buffer_size_x=-1, buffer_size_y=-1)

info: will draw tam_buffer or part of a TAMBuffer onto another TAMBuffer :param tam_buffer: TAMBuffer :param start_x: int :param start_y: int :param buffer_start_x: int :param buffer_start_y: int :param buffer_size_x: int: 0 - inf :param buffer_size_y: int: 0 - inf :return:

get_defaults()

info: gets defaults :return: (str, int, int)

get_dimensions()

info: gets buffer dimensions :return: (int, int)

get_from_raw_spot(spot)

info: gets spot info :param spot: x: int: 0 - (len(tam_buffer) - 1) :return: (int, int, int) or None

get_raw_buffers()

info: gets raw buffers :return: (list, list, list)

get_raw_spot(x, y)

info: return -1 if not a spot :param x: int :param y: int :return: int

get_spot(x, y)

info: gets spot info :param x: int :param y: int :return: (int, int, int) or None

replace_alpha_chars(alpha_replacement=None)
Parameters:alpha_replacement – None or str
Returns:
set_defaults_and_clear(char, foreground_color, background_color)

info: clears buffer and resets defaults :param char: str: len of 1 :param foreground_color: int: 0 - inf :param background_color: int: 0 - inf :return:

set_dimensions_and_clear(width, height)

info: clears and resizes TAMBuffer :param width: int: 0 - inf :param height: int: 0 - inf :return:

set_spot(x, y, char, foreground_color, background_color, override_alpha=False)

info: sets a single spot on the buffer :param x: int :param y: int :param char: str: len of 1 :param foreground_color: int :param background_color: int :param override_alpha: bool :return:

to_bytes()

info: object to bytes :return: bytes

tamcolors.tam_io.tam_colors module

class tamcolors.tam_io.tam_colors.Color(mode_16, mode_256, mode_rgb, mode_16_pal_256=None, mode_2=None)

Bases: tamcolors.utils.immutable_cache.ImmutableCache, tamcolors.utils.object_packer.FastHandObjectPacker

classmethod from_bytes(object_byte_array)

info: from bytes to object :param object_byte_array: bytearray :return: object

has_alpha

info: Checks if color has any alpha :return: bool

mode_16

info: Gets mode 16 :return: int

mode_16_pal_256

info: Gets mode 16 pal 256 :return: int

mode_2

info: Gets mode 2 :return: int

mode_256

info: Gets mode 256 :return: int

mode_rgb

info: Gets mode rgb :return: RGBA

place_color_over(old_color, override_alpha)

info: Will calculate what the new color will be :param old_color: Color :param override_alpha: bool :return: color

to_bytes()

info: object to bytes :return: bytes

transparent_value
class tamcolors.tam_io.tam_colors.RGBA(r, g, b, a=255, is_default=False)

Bases: tamcolors.utils.immutable_cache.ImmutableCache, tamcolors.utils.object_packer.FastHandObjectPacker

a

info: Will get the a value :return: int

b

info: Will get the b value :return: int

classmethod from_bytes(object_byte_array)

info: from bytes to object :param object_byte_array: bytearray :return: object

g

info: Will get the g value :return: int

is_default

info: See if color is default :return: bool

r

info: Will get the r value :return: int

to_bytes()

info: object to bytes :return: bytes

tamcolors.tam_io.tam_drivers module

class tamcolors.tam_io.tam_drivers.ColorChangerDriver(identifier, mode_2=True, mode_16_pal_256=True, mode_16=True, mode_256=True, mode_rgb=True, key_driver_operational=True, color_driver_operational=True, color_changer_driver_operational=True, utilities_driver_operational=True)

Bases: tamcolors.tam_io.tam_drivers.TAMDriver, abc.ABC

get_color_16(spot)

info: Will get color from color palette 16 :param spot: int :return: RGBA

get_color_16_pal_256(spot)

info: Will get color from color palette 16 :param spot: int :return: int

get_color_2(spot)

info: Will get color from color palette 2 :param spot: int :return: RGBA

get_color_256(spot)

info: Will get color from color palette 256 :param spot: int :return: RGBA

set_color_16(spot, color)

info: sets a color value :param spot: int :param color: RGBA :return: None

set_color_16_pal_256(spot, color)

info: sets a color value :param spot: int :param color: int :return: None

set_color_2(spot, color)

info: sets a color value :param spot: int :param color: RGBA :return: None

set_color_256(spot, color)

info: sets a color value :param spot: int :param color: RGBA :return: None

set_mode(mode)

info: will set the color mode :param mode: int: key to color mode :return:

class tamcolors.tam_io.tam_drivers.ColorDriver(identifier, mode_2=True, mode_16_pal_256=True, mode_16=True, mode_256=True, mode_rgb=True, key_driver_operational=True, color_driver_operational=True, color_changer_driver_operational=True, utilities_driver_operational=True)

Bases: tamcolors.tam_io.tam_drivers.TAMDriver, abc.ABC

draw(tam_buffer)

info: Will draw TAMBuffer to console :param tam_buffer: TAMBuffer :return: None

get_printc_mode()

Gets the modes used by printc and inputc :return: str

inputc(output, color)

info: Will get input from the console in color :param output: str :param color: COLOR :return: str

printc(output, color, flush, stderr)

info: Will print to the console in color :param output: str :param color: COLOR :param flush: bool :param stderr: std :return:

set_mode(mode)

info: will set the color mode :param mode: int: key to color mode :return:

class tamcolors.tam_io.tam_drivers.FullColorDriver(identifier, mode_2=True, mode_16_pal_256=True, mode_16=True, mode_256=True, mode_rgb=True, key_driver_operational=True, color_driver_operational=True, color_changer_driver_operational=True, utilities_driver_operational=True)

Bases: tamcolors.tam_io.tam_drivers.ColorDriver, tamcolors.tam_io.tam_drivers.ColorChangerDriver, abc.ABC

class tamcolors.tam_io.tam_drivers.KeyDriver(identifier, mode_2=True, mode_16_pal_256=True, mode_16=True, mode_256=True, mode_rgb=True, key_driver_operational=True, color_driver_operational=True, color_changer_driver_operational=True, utilities_driver_operational=True)

Bases: tamcolors.tam_io.tam_drivers.TAMDriver, abc.ABC

enable_console_keys(enable)

info: will enable console keys :param enable: boool :return: None

get_key()

info: Gets an input from the terminal :return: tuple or false

static get_key_dict()

info: Gets a dict of all the keys :return: {str: (str, str), …}

class tamcolors.tam_io.tam_drivers.TAMDriver(identifier, mode_2=True, mode_16_pal_256=True, mode_16=True, mode_256=True, mode_rgb=True, key_driver_operational=True, color_driver_operational=True, color_changer_driver_operational=True, utilities_driver_operational=True)

Bases: tamcolors.tam_io.io_tam.IO, abc.ABC

classmethod able_to_execute()

info: checks that io is stable in current environment :return: bool

done()

info: operations for IO to stop :return: None

start()

info: operations for IO to start :return: None

class tamcolors.tam_io.tam_drivers.UtilitiesDriver(identifier, mode_2=True, mode_16_pal_256=True, mode_16=True, mode_256=True, mode_rgb=True, key_driver_operational=True, color_driver_operational=True, color_changer_driver_operational=True, utilities_driver_operational=True)

Bases: tamcolors.tam_io.tam_drivers.TAMDriver, abc.ABC

clear()

info: Will clear the console :return: None

get_dimensions()

info: Gets the dimensions of console :return: (int, int): (row, column)

show_console_cursor(show)

info: Will show or hide console cursor :param show: int :return: None

tamcolors.tam_io.tam_identifier module

class tamcolors.tam_io.tam_identifier.TAMIdentifier(name, *drivers)

Bases: object

get_all_drivers()

info: Get a list of all the tam drivers being used :return: list

get_info_dict()

info: Get raw info about this identifier :return: dict

get_io()

info: Gets the IO that the selected drivers made :return: IO

get_name()

info: Get the general name of the drivers :return: str

get_system()

info: Get the system :return: str

classmethod identify()

info: Will find the best drivers for current environment :return: TAMIdentifier

stable()

info: Sees if this IO is able to execute :return: bool

tamcolors.tam_io.tam_keys module

tamcolors.tam_io.tcp_io module

tamcolors.tam_io.tcp_io.get_tcp_io(receiver)

info: will return TCPObjectConnector connected to an io object :param receiver: TCPReceiver :return: TCPObjectConnector

tamcolors.tam_io.uni_drivers module

class tamcolors.tam_io.uni_drivers.UNIKeyDriver(*args, **kwargs)

Bases: tamcolors.tam_io.tam_drivers.KeyDriver, tamcolors.tam_io.uni_drivers.UNISharedData, abc.ABC

enable_console_keys(enable)

info: will enable console keys :param enable: boool :return: None

get_key()

info: Gets an input from the terminal :return: tuple or false

static get_key_dict()

info: Gets a dict of all the keys :return: {str: (str, str), …}

class tamcolors.tam_io.uni_drivers.UNISharedData(identifier, mode_2=True, mode_16_pal_256=True, mode_16=True, mode_256=True, mode_rgb=True, key_driver_operational=True, color_driver_operational=True, color_changer_driver_operational=True, utilities_driver_operational=True)

Bases: tamcolors.tam_io.tam_drivers.TAMDriver, abc.ABC

classmethod able_to_execute()

info: checks that io is stable in current environment :return: bool

class tamcolors.tam_io.uni_drivers.UNIUtilitiesDriver(identifier, mode_2=True, mode_16_pal_256=True, mode_16=True, mode_256=True, mode_rgb=True, key_driver_operational=True, color_driver_operational=True, color_changer_driver_operational=True, utilities_driver_operational=True)

Bases: tamcolors.tam_io.tam_drivers.UtilitiesDriver, tamcolors.tam_io.uni_drivers.UNISharedData, abc.ABC

clear()

info: Will clear the console :return: None

done()

info: operations for IO to stop :return: None

get_dimensions()

info: Gets the dimensions of console :return: (int, int): (row, column)

show_console_cursor(show)

info: Will show or hide console cursor :param show: int :return: None

tamcolors.tam_io.win_drivers module

class tamcolors.tam_io.win_drivers.WINFullColorDriver(*args, **kwargs)

Bases: tamcolors.tam_io.tam_drivers.FullColorDriver, tamcolors.tam_io.win_drivers.WinSharedData, abc.ABC

done()

info: operations for IO to stop :return: None

draw(tam_buffer)

info: will draw tam buffer to terminal :param tam_buffer: TAMBuffer :return:

get_printc_mode()

Gets the modes used by printc and inputc :return: str

inputc(output, color)

info: will get user input with color :param output: str :param color: tuple: (int, int) :return: str

printc(output, color, flush, stderr)

info: will print out user output with color :param output: str :param color: tuple: (int, int) :param flush: boolean :param stderr: boolean :return: None

set_mode(mode)

info: will set the color mode :param mode: int: key to color mode :return:

class tamcolors.tam_io.win_drivers.WINKeyDriver(*args, **kwargs)

Bases: tamcolors.tam_io.tam_drivers.KeyDriver, tamcolors.tam_io.win_drivers.WinSharedData, abc.ABC

get_key()

info: will get single key input or return False :return: str or False

static get_key_dict()

info: makes a dict mapping key codes to key :return: dict

class tamcolors.tam_io.win_drivers.WINUtilitiesDriver(*args, **kwargs)

Bases: tamcolors.tam_io.tam_drivers.UtilitiesDriver, tamcolors.tam_io.win_drivers.WinSharedData, abc.ABC

clear()

info: will clear the screen :return:

done()

info: operations for IO to stop :return: None

get_dimensions()

info: will get teh terminal dimensions :return: (int, int)

show_console_cursor(show)

info: Will show or hide console cursor :param show: bool :return: None

start()

info: operations for IO to start :return: None

class tamcolors.tam_io.win_drivers.WinSharedData(identifier, mode_2=True, mode_16_pal_256=True, mode_16=True, mode_256=True, mode_rgb=True, key_driver_operational=True, color_driver_operational=True, color_changer_driver_operational=True, utilities_driver_operational=True)

Bases: tamcolors.tam_io.tam_drivers.TAMDriver, abc.ABC

classmethod able_to_execute()

info: checks that io is stable in current environment :return: bool

Module contents