tamcolors.tam_tools package

Submodules

tamcolors.tam_tools.tam_color_palette module

class tamcolors.tam_tools.tam_color_palette.TAMColorPalette(color_range=range(0, 16), color_rules=None)

Bases: object

get_color(key)

info: gets a color from the color palette :param key: object :return:

get_rule(key)

info: gets a instance of TAMColorPaletteRule or None :param key: object :return: instance of TAMColorPaletteRule or None

key_present(key)

info: checks if key is in color palette :param key: object :return: bool

set_color(key, color)

info sets a color to the color palette :param key: object :param color: Color :return:

set_rule(key, rule)

info: sets a color rule :param key: object :param rule: instance of TAMColorPaletteRule :return:

update()

info: updates color_palette rules :return:

exception tamcolors.tam_tools.tam_color_palette.TAMColorPaletteError

Bases: Exception

class tamcolors.tam_tools.tam_color_palette.TAMColorPaletteRule

Bases: object

update(color_palette, key)
class tamcolors.tam_tools.tam_color_palette.TAMCycleColor(colors, clock=1)

Bases: tamcolors.tam_tools.tam_color_palette.TAMColorPaletteRule

get_clock()

info: gets the clock rate :return: int

set_clock(clock)

info: sets the clock :param clock: int :return: int: 1 - inf

set_colors(colors)

info: sets all the colors :param colors: tuple or int: [Color, Color, Color, …] :return:

update(color_palette, key)

info: will update the color_palette color :param color_palette: TAMColorPalette :param key: object :return:

class tamcolors.tam_tools.tam_color_palette.TAMDefaultColor(color)

Bases: tamcolors.tam_tools.tam_color_palette.TAMColorPaletteRule

get_color()

info: gets the default color :return: Color

set_color(color)

info: sets the default color :param color: Color :return:

update(color_palette, key)

info: will update the color_palette color :param color_palette: TAMColorPalette :param key: object :return:

tamcolors.tam_tools.tam_fade module

tamcolors.tam_tools.tam_fade.tam_fade_in(surface, char, foreground_color, background_color, rand=(True, False, False, False, False), reverse=False)

info: makes a fade in or fade out via TAMFilm :param surface: TAMSurface :param char: single block char :param foreground_color: Color :param background_color: Color :param rand: list: [True, bool, bool, bool, …] :param reverse: bool :return: TAMFilm

tamcolors.tam_tools.tam_film module

class tamcolors.tam_tools.tam_film.TAMFilm(tam_surfaces=None, circular=False)

Bases: object

append(tam_surface)

info :param tam_surface: :return:

done()

info: returns true if film is done :return: bool

get(spot)

info will get a TAMSurface :param spot: int: 0 - len(self._surface_list) :return: TAMSurface

get_circular()

info: gets the circular value :return: bool

peak()

info: gets the current frame :return: TAMSurface or None

pop()

info: will pop the last TAMSurface :return: TAMSurface or None

set(spot, tam_surface)

info: sets a frame :param spot: int: 0 - len(self._surface_list) :param tam_surface: TAMSurface :return:

set_circular(circular)

info: can set circular value :param circular: True :return:

slide()

info will get the next TAMSurface :return: TAMSurface or None

exception tamcolors.tam_tools.tam_film.TAMFilmError

Bases: Exception

tamcolors.tam_tools.tam_icon module

tamcolors.tam_tools.tam_icon.get_icon()

tamcolors.tam_tools.tam_key_manager module

class tamcolors.tam_tools.tam_key_manager.TAMKeyManager(all_keys={('t', 'WHITESPACE'), ('n', 'WHITESPACE'), (' ', 'WHITESPACE'), ('!', 'NORMAL'), ('"', 'NORMAL'), ('#', 'NORMAL'), ('$', 'NORMAL'), ('%', 'NORMAL'), ('&', 'NORMAL'), ("'", 'NORMAL'), ('(', 'NORMAL'), (')', 'NORMAL'), ('*', 'NORMAL'), ('+', 'NORMAL'), (', ', 'NORMAL'), ('-', 'NORMAL'), ('.', 'NORMAL'), ('/', 'NORMAL'), ('0', 'NORMAL'), ('1', 'NORMAL'), ('2', 'NORMAL'), ('3', 'NORMAL'), ('4', 'NORMAL'), ('5', 'NORMAL'), ('6', 'NORMAL'), ('7', 'NORMAL'), ('8', 'NORMAL'), ('9', 'NORMAL'), (':', 'NORMAL'), (';', 'NORMAL'), ('<', 'NORMAL'), ('=', 'NORMAL'), ('>', 'NORMAL'), ('?', 'NORMAL'), ('@', 'NORMAL'), ('A', 'NORMAL'), ('B', 'NORMAL'), ('BACKSPACE', 'SPECIAL'), ('C', 'NORMAL'), ('D', 'NORMAL'), ('DELETE', 'SPECIAL'), ('DOWN', 'SPECIAL'), ('E', 'NORMAL'), ('ESCAPE', 'SPECIAL'), ('F', 'NORMAL'), ('F1', 'SPECIAL'), ('F12', 'SPECIAL'), ('F12_SHIFT', 'SPECIAL'), ('F1_SHIFT', 'SPECIAL'), ('F2', 'SPECIAL'), ('F2_SHIFT', 'SPECIAL'), ('F3', 'SPECIAL'), ('F3_SHIFT', 'SPECIAL'), ('F4', 'SPECIAL'), ('F4_SHIFT', 'SPECIAL'), ('F5', 'SPECIAL'), ('F5_SHIFT', 'SPECIAL'), ('F6', 'SPECIAL'), ('F6_SHIFT', 'SPECIAL'), ('F7', 'SPECIAL'), ('F7_SHIFT', 'SPECIAL'), ('F8', 'SPECIAL'), ('F8_SHIFT', 'SPECIAL'), ('F9', 'SPECIAL'), ('F9_SHIFT', 'SPECIAL'), ('G', 'NORMAL'), ('H', 'NORMAL'), ('I', 'NORMAL'), ('J', 'NORMAL'), ('K', 'NORMAL'), ('L', 'NORMAL'), ('LEFT', 'SPECIAL'), ('M', 'NORMAL'), ('N', 'NORMAL'), ('O', 'NORMAL'), ('P', 'NORMAL'), ('Q', 'NORMAL'), ('R', 'NORMAL'), ('RIGHT', 'SPECIAL'), ('S', 'NORMAL'), ('T', 'NORMAL'), ('U', 'NORMAL'), ('UP', 'SPECIAL'), ('V', 'NORMAL'), ('W', 'NORMAL'), ('X', 'NORMAL'), ('Y', 'NORMAL'), ('Z', 'NORMAL'), ('[', 'NORMAL'), ('\', 'NORMAL'), (']', 'NORMAL'), ('^', 'NORMAL'), ('_', 'NORMAL'), ('`', 'NORMAL'), ('a', 'NORMAL'), ('b', 'NORMAL'), ('c', 'NORMAL'), ('d', 'NORMAL'), ('e', 'NORMAL'), ('f', 'NORMAL'), ('g', 'NORMAL'), ('h', 'NORMAL'), ('i', 'NORMAL'), ('j', 'NORMAL'), ('k', 'NORMAL'), ('l', 'NORMAL'), ('m', 'NORMAL'), ('n', 'NORMAL'), ('o', 'NORMAL'), ('p', 'NORMAL'), ('q', 'NORMAL'), ('r', 'NORMAL'), ('s', 'NORMAL'), ('t', 'NORMAL'), ('u', 'NORMAL'), ('v', 'NORMAL'), ('w', 'NORMAL'), ('x', 'NORMAL'), ('y', 'NORMAL'), ('z', 'NORMAL'), ('{', 'NORMAL'), ('|', 'NORMAL'), ('}', 'NORMAL'), ('~', 'NORMAL'), ('£', 'NORMAL'), ('¬', 'NORMAL')})

Bases: object

get_key_state(key)

info: will get a state of a key :param key: str :return: int

get_raw_user_input()

info: will get the raw user input :return: list or tuple: [(str, str), …]

get_user_input()

info: will the next key the user enters :return: tuple, list or None: (str, str)

get_user_input_generator()

info: yields a key at a time :return: list or tuple: (str, str)

silent_key_state(key)

info: will get a key state and make it 0 :param key: str :return: int

update(keys)

info: will update key manager with next set of keys :param keys: tuple or list: [(str, str), …] :return:

tamcolors.tam_tools.tam_list_surface module

tamcolors.tam_tools.tam_list_surface.tam_list_surface(chars, foreground_colors, background_colors)

info: makes a list into a TAMSurface :param chars: list, tuple :param foreground_colors: list, tuple, Color :param background_colors: list, tuple, Color :return: TAMSurface

tamcolors.tam_tools.tam_menu module

class tamcolors.tam_tools.tam_menu.TAMButtonRule

Bases: object

draw(tam_surface)
get_action()
get_position()
off()
on()
run_action()
set_action(func)
set_position(x, y)
update()
class tamcolors.tam_tools.tam_menu.TAMMenu(buttons, call_key, goto_map, on=0)

Bases: object

draw(tam_surface)

info: draw all the buttons of the menu :param tam_surface: TAMSurface :return:

get_buttons()

info: gets the buttons :return: list

get_call_key()

info: gets the call key :return: str

get_goto_map()

info: gets the goto map :return: dict

get_on()

info: gets the on value :return: int

static simple_menu_builder(buttons, call_on, up_keys=('UP', ), down_keys=('DOWN', ), on=0)

info: a simple way of making a TAMMenu :param buttons: TAMButtonRule :param call_on: str :param up_keys: list or tuple: (str, …) :param down_keys: list or tuple: (str, …) :param on: int :return: TAMMenu

update(keys)

info: update the menu :param keys: list or tuple: [(str, str), (str, str, …), …] :return:

class tamcolors.tam_tools.tam_menu.TAMTextBoxButton(text, x, y, width, height, char, foreground_color, background_color, action_func, on_foreground_color, on_background_color, on_char='/', clock=-1, center_vertical=True, center_horizontal=False, vertical_space=1, vertical_start=1, char_background=' ')

Bases: tamcolors.tam_tools.tam_menu.TAMButtonRule

draw(tam_surface)

info: draws button onto surface :param tam_surface: :return:

get_action()

info: gets action function :return: fuction

get_position()

info: gets the position :return:

off()

info: puts the button onto the off state :return:

on()

info: puts the button onto the on state :return:

run_action()

” info: calls the action function :return:

set_action(func)

info: sets the actions :param func: function :return:

set_position(x, y)

info: sets the position :param x: int :param y: int :return:

update()

info: updates the button :return:

class tamcolors.tam_tools.tam_menu.TAMTextButton(text, x, y, foreground_color, background_color, action_func, on_foreground_color, on_background_color, on_chars='* ')

Bases: tamcolors.tam_tools.tam_menu.TAMButtonRule

draw(tam_surface)

info: draws button onto surface :param tam_surface: :return:

get_action()

info: gets action function :return: fuction

get_position()

info: gets the position :return:

off()

info: puts the button onto the off state :return:

on()

info: puts the button onto the on state :return:

run_action()

” info: calls the action function :return:

set_action(func)

info: sets the actions :param func: function :return:

set_position(x, y)

info: sets the position :param x: int :param y: int :return:

update()

info: updates the button :return:

tamcolors.tam_tools.tam_placing module

tamcolors.tam_tools.tam_placing.bottom_left(x, y, width, height)

info: gets the bottom left x, y :param x: int :param y: int :param width: int: 0 - inf :param height: int: 0 - inf :return: (int, int)

tamcolors.tam_tools.tam_placing.bottom_right(x, y, width, height)

info: gets the bottom right x, y :param x: int :param y: int :param width: int: 0 - inf :param height: int: 0 - inf :return: (int, int)

tamcolors.tam_tools.tam_placing.center(x, y, width, height)

info: gets the center x, y :param x: int :param y: int :param width: int: 0 - inf :param height: int: 0 - inf :return: (int, int)

tamcolors.tam_tools.tam_placing.top_left(x, y, width, height)

info: gets the top left x, y :param x: int :param y: int :param width: int: 0 - inf :param height: int: 0 - inf :return: (int, int)

tamcolors.tam_tools.tam_placing.top_right(x, y, width, height)

info: gets the top right x, y :param x: int :param y: int :param width: int: 0 - inf :param height: int: 0 - inf :return: (int, int)

tamcolors.tam_tools.tam_print module

tamcolors.tam_tools.tam_print.tam_print(tam_surface, x, y, text, foreground_color, background_color, error_bad_char=False, bad_char='')

info: tam_print will draw string on a tam_surface :param tam_surface: TAMSurface :param x: int :param y: int :param text: object with __str__ :param foreground_color: int: -1 - inf: use current foreground_color :param background_color: int: -1 - inf: use current background_color :param error_bad_char: bool :param bad_char: str :return:

tamcolors.tam_tools.tam_str module

exception tamcolors.tam_tools.tam_str.TAMStrError

Bases: Exception

tamcolors.tam_tools.tam_str.make_tam_str(text, end_line='\n', bad_char=None)

info: formats str into a tam str :param text: str :param end_line: str :param bad_char: str :return: str

tamcolors.tam_tools.tam_text_box module

class tamcolors.tam_tools.tam_text_box.TAMTextBox(text, width, height, char, foreground_color, background_color, clock=-1, center_vertical=True, center_horizontal=False, vertical_space=1, vertical_start=1, char_background=' ')

Bases: object

done()

info: True if text box has placed all chars onto to its self :return: bool

draw(tam_surface, start_x=0, start_y=0)

info: draws the text box on to another surface :param tam_surface: TAMSurface :param start_x: int :param start_y: int :return:

get_char()

info: gets char :return: str

get_colors()

info: gets textbox color :return: (int, int)

get_dimensions()

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

get_text()

info: gets text :return: str

set_char(char)

info: sets char :return:

set_colors(foreground_color, background_color)

info: sets textbox colors :param foreground_color: 0 - inf :param background_color: 0 - inf :return:

update()

info updates the text box :return:

Module contents