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_surface)

info: Will draw TAMSurface to console :param tam_surface: TAMSurface :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_surface)

info: Will draw TAMSurface to console :param tam_surface: TAMSurface :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.ANYFullColorDriver(*args, **kwargs)

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

draw(tam_surface)

info: Will draw TAMSurface to console :param tam_surface: TAMSurface :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

get_key_dict(language=None)

info: Gets a dict of all the keys :param language: str or None :return: dict

get_keyboard_name(default_to_us_english=True)

info: Will get the keyboard language name :param default_to_us_english: bool :return: str

wait_key(rest_time=0.0001, attempts=300000)

info: Get an input from the terminal :param: rest_time: float: rest time from checking if a key is down :param: attempts: int: number of attempts to get a key :return: tuple or false

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

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

close_sound(sound_id)

info: will close sound :param sound_id: int :return: None

get_sound_length(sound_id)

info: will get sound lenght :param sound_id: int :return: int

get_sound_position(sound_id)

info: will get the time spot of the song :param sound_id: int :return: int

is_sound_playing(sound_id)

info: will check if sound is playing :param sound_id: int :return: bool

open_sound(file, sound_id)

info: will open .wav sound :param file: str :param sound_id: int :return: None

pause_sound(sound_id)

info: will pause sound :param sound_id: int :return: None

play_sound(sound_id, reset_sound=True)

info: will play sound :param sound_id: int :param reset_sound: bool :return: None

set_sound_position(sound_id, spot)

info: will set the spot of the sound :param sound_id: int :param spot: int :return: None

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, sound_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

apply_snapshot(snapshot)

info: apply snapshot state to IO :param snapshot: dict :return: None

clear()

info: Will clear the console :return: None

close_sound(sound_id)

info: will close sound :param sound_id: int :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_surface)

info: Will draw TAMSurface to console :param tam_surface: TAMSurface :return: None

enable_console_keys(enable)

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

enable_event_bus(bus=True)

info: will enable the event bus :param bus: bool :return: None

enable_key_state_mode(enable=True)

info: Will enable or disable key state mode :param enable: bool :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_event()

info: will get event :yield: tuple

get_info_dict()

info: will get the identifier dict :return: dict

get_key()

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

get_key_dict(language=None)

info: Gets a dict of all the keys :param language: str or None :return: dict

get_keyboard_name(default_to_us_english=True)

info: Will get the keyboard language name :param default_to_us_english: bool :return: 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

get_snapshot()

info: get snapshot of IO :return: dict

get_sound_length(sound_id)

info: will get sound length :param sound_id: int :return: int

get_sound_position(sound_id)

info: will get the time spot of the song :param sound_id: int :return: int

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

is_event_bus_enabled()

info: will check if event bus is enabled :return: bool

is_key_state_mode_enabled()

info: Will get the status of key_state :return: bool

is_running()

info: checks if IO has been started :return: bool

is_sound_playing(sound_id)

info: will check if sound is playing :param sound_id: int :return: bool

key_driver_operational()

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

open_sound(file, sound_id)

info: will open .wav sound :param file: str :param sound_id: int :return: None

pause_sound(sound_id)

info: will pause sound :param sound_id: int :return: None

play_sound(sound_id, reset_sound=True)

info: will play sound :param sound_id: int :param reset_sound: bool :return: None

prime_event_bus()

info: will repeat the last event for every type other than keys :return: None

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

rest_sound(sound_id)

info: will reset sound :param sound_id: int :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_sound_position(sound_id, spot)

info: will set the spot of the sound :param sound_id: int :param spot: int :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

sound_driver_operational()

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

start()

info: operations for IO to start :return: None

utilities_driver_operational()

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

wait_key(rest_time=0.0001, attempts=None)

info: Get an input from the terminal :param: rest_time: float: rest time from checking if a key is down :param: attempts: int or None: number of attempts to get a key :return: tuple or false

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

apply_snapshot(snapshot)

info: apply snapshot state to IO :param snapshot: dict :return: None

clear()

info: Will clear the console :return: None

close_sound(sound_id)

info: will close sound :param sound_id: int :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_surface)

info: Will draw TAMSurface to console :param tam_surface: TAMSurface :return: None

enable_console_keys(enable)

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

enable_event_bus(bus=True)

info: will enable the event bus :param bus: bool :return: None

enable_key_state_mode(enable=True)

info: Will enable or disable key state mode :param enable: bool :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_event()

info: will get event :yield: tuple

get_info_dict()

info: will get the identifier dict :return: dict

get_key()

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

get_key_dict(language=None)

info: Gets a dict of all the keys :param language: str or None :return: dict

get_keyboard_name(default_to_us_english=True)

info: Will get the keyboard language name :param default_to_us_english: bool :return: 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

get_snapshot()

info: get snapshot of IO :return: dict

get_sound_length(sound_id)

info: will get sound length :param sound_id: int :return: int

get_sound_position(sound_id)

info: will get the time spot of the song :param sound_id: int :return: int

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

is_event_bus_enabled()

info: will check if event bus is enabled :return: bool

is_key_state_mode_enabled()

info: Will get the status of key_state :return: bool

is_running()

info: checks if IO has been started :return: bool

is_sound_playing(sound_id)

info: will check if sound is playing :param sound_id: int :return: bool

key_driver_operational()

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

open_sound(file, sound_id)

info: will open .wav sound :param file: str :param sound_id: int :return: None

pause_sound(sound_id)

info: will pause sound :param sound_id: int :return: None

play_sound(sound_id, reset_sound=True)

info: will play sound :param sound_id: int :param reset_sound: bool :return: None

prime_event_bus()

info: will repeat the last event for every type other than keys :return: None

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

rest_sound(sound_id)

info: will reset sound :param sound_id: int :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_sound_position(sound_id, spot)

info: will set the spot of the sound :param sound_id: int :param spot: int :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: int :return: None

sound_driver_operational()

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

start()

info: operations for IO to start :return: None

utilities_driver_operational()

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

wait_key(rest_time=0.0001, attempts=300000)

info: Get an input from the terminal :param: rest_time: float: rest time from checking if a key is down :param: attempts: int: number of attempts to get a key :return: tuple or false

exception tamcolors.tam_io.io_tam.TAMSoundError

Bases: Exception

tamcolors.tam_io.null_drivers module

class tamcolors.tam_io.null_drivers.NULLFullColorDriver(*args, **kwargs)

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

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:

class tamcolors.tam_io.null_drivers.NULLKeyDriver(*args, **kwargs)

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

get_key()

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

classmethod get_key_dict(language=None)

info: Gets a dict of all the keys :param language: str or None :return: dict

get_keyboard_name(default_to_us_english=True)

info: Will get the keyboard language name :param default_to_us_english: bool :return: str

wait_key(rest_time=0.0001, attempts=300000)

info: Get an input from the terminal :param: rest_time: float: rest time from checking if a key is down :param: attempts: int: number of attempts to get a key :return: tuple or false

class tamcolors.tam_io.null_drivers.NULLSoundDriver(*args, **kwargs)

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

close_sound(sound_id)

info: will close sound :param sound_id: int :return: None

get_sound_length(sound_id)

info: will get sound lenght :param sound_id: int :return: int

get_sound_position(sound_id)

info: will get the time spot of the song :param sound_id: int :return: int

is_sound_playing(sound_id)

info: will check if sound is playing :param sound_id: int :return: bool

open_sound(file, sound_id)

info: will open .wav sound :param file: str :param sound_id: int :return: None

pause_sound(sound_id)

info: will pause sound :param sound_id: int :return: None

play_sound(sound_id, reset_sound=True)

info: will play sound :param sound_id: int :param reset_sound: bool :return: None

set_sound_position(sound_id, spot)

info: will set the spot of the sound :param sound_id: int :param spot: int :return: None

class tamcolors.tam_io.null_drivers.NULLUtilitiesDriver(*args, **kwargs)

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

get_dimensions()

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

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, _color_id=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, sound_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, sound_driver_operational=True)

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

draw(tam_surface)

info: Will draw TAMSurface to console :param tam_surface: TAMSurface :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, sound_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, sound_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

get_key_dict(language=None)

info: Gets a dict of all the keys :param language: str or None :return: dict

get_keyboard_name(default_to_us_english=True)

info: Will get the keyboard language name :param default_to_us_english: bool :return: str

wait_key(rest_time=0.0001, attempts=300000)

info: Get an input from the terminal :param: rest_time: float: rest time from checking if a key is down :param: attempts: int: number of attempts to get a key :return: tuple or false

class tamcolors.tam_io.tam_drivers.SoundDriver(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, sound_driver_operational=True)

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

close_sound(sound_id)

info: will close sound :param sound_id: int :return: None

get_sound_length(sound_id)

info: will get sound lenght :param sound_id: int :return: int

get_sound_position(sound_id)

info: will get the time spot of the song :param sound_id: int :return: int

is_sound_playing(sound_id)

info: will check if sound is playing :param sound_id: int :return: bool

open_sound(file, sound_id)

info: will open .wav sound :param file: str :param sound_id: int :return: None

pause_sound(sound_id)

info: will pause sound :param sound_id: int :return: None

play_sound(sound_id, reset_sound=True)

info: will play sound :param sound_id: int :param reset_sound: bool :return: None

set_sound_position(sound_id, spot)

info: will set the spot of the sound :param sound_id: int :param spot: int :return: None

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, sound_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, sound_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

terminal keys supported on all platforms

class tamcolors.tam_io.tam_keys.Keyboard(name, key_spot_dict, key_dict=None, key_state_dict=None)

Bases: object

code_to_key(code)

info: will get key from code :param code: object :return: tuple or False

code_to_key_state(code)

info: will get key from code :param code: object :return: tuple or False

get_key_dict()

info: will get key dict :return: dict or None

get_key_list()
get_key_spot_dict()

info: will get key spot dict :return: dict

get_key_state_dict()

info: will get key state dict :return: dict or None

get_name()

info: will get keyboard name :return: str

key_to_spot(key)

info: will get spot from key :param key: tuple :return: int or None

static split_code_dict(code_dict)

info: will split a code dict :param code_dict: dict: {tuple: (object, object)} :return: dict, dict

spot_to_key(spot)

info: will get key from spot :param spot: int :return: tuple or None

tamcolors.tam_io.tam_surface module

class tamcolors.tam_io.tam_surface.TAMSurface(width, height, char, foreground_color, background_color)

Bases: tamcolors.utils.object_packer.FastHandObjectPacker

clear()

info: clears TAMSurface :return:

copy()

info: copy’s TAMSurface :return: TAMSurface

draw_onto(tam_surface, start_x=0, start_y=0, surface_start_x=0, surface_start_y=0, surface_size_x=-1, surface_size_y=-1, override_alpha=False)

info: will draw tam_surface or part of a TAMSurface onto another TAMSurface :param tam_surface: TAMSurface :param start_x: int :param start_y: int :param surface_start_x: int :param surface_start_y: int :param surface_size_x: int: 0 - inf :param surface_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_surface, start_x=0, start_y=0, surface_start_x=0, surface_start_y=0, surface_size_x=-1, surface_size_y=-1)

info: will draw tam_surface or part of a TAMSurface onto another TAMSurface :param tam_surface: TAMSurface :param start_x: int :param start_y: int :param surface_start_x: int :param surface_start_y: int :param surface_size_x: int: 0 - inf :param surface_size_y: int: 0 - inf :return:

get_defaults()

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

get_dimensions()

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

get_from_raw_spot(spot)

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

get_raw_spot(x, y)

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

get_raw_surface()

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

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 surface 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 TAMSurface :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 surface :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.tcp_io module

tamcolors.tam_io.tcp_io.get_tcp_io(receiver, wait=True)

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

tamcolors.tam_io.tcp_io.run_tcp_connection(connection, io=None)

info: will run a tcp connection :param connection: TCPConnection :param io: IO or None: None will uses default IO :return: None

tamcolors.tam_io.uni_drivers module

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, sound_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, sound_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_surface)

info: will draw tam surface to terminal :param tam_surface: TAMSurface :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

get_key_dict(language=None)

info: Gets a dict of all the keys :param language: str or None :return: dict

get_keyboard_name(default_to_us_english=True)

info: Will get the keyboard language name :param default_to_us_english: bool :return: str

class tamcolors.tam_io.win_drivers.WINSoundDriver(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, sound_driver_operational=True)

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

close_sound(sound_id)

info: will close sound :param sound_id: int :return: None

get_sound_length(sound_id)

info: will get sound length :param sound_id: int :return: int

get_sound_position(sound_id)

info: will get the time spot of the song :param sound_id: int :return: int

is_sound_playing(sound_id)

info: will check if sound is playing :param sound_id: int :return: bool

open_sound(file, sound_id)

info: will open .wav sound :param file: str :param sound_id: int :return: None

pause_sound(sound_id)

info: will pause sound :param sound_id: int :return: None

play_sound(sound_id, reset_sound=True)

info: will play sound :param sound_id: int :param reset_sound: bool :return: None

set_sound_position(sound_id, spot)

info: will set the spot of the sound :param sound_id: int :param spot: int :return: None

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, sound_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