Welcome to tamcolors’s documentation!¶
about¶
tamcolors is a terminal game library which supports multiplayer and audio. tamcolors gives a buffer which lets the user set the character, foreground color and background color which can draw at a stable FPS of 25 on all supported console.
pip install tamcolors¶
basic example¶
import tamcolors
tamcolors.examples.basic_console.run()
from tamcolors.tam_basic import console
from tamcolors.tam_io.tam_colors import *
console.printc("Hello", "World!", ("light blue", "white"), same_color=True)
name = console.inputc("Whats Your Name? >>> ", ("light aqua", "gray"))
console.clear()
console.printc("Hello, ", ("default", "default"), name, (GREEN, WHITE), "!", ("gray", "light aqua"), sep="")
icon example¶
import tamcolors
tamcolors.examples.icon.run()
tamcolors¶
tamcolors package¶
Subpackages¶
tamcolors.examples package¶
-
class
tamcolors.examples.alpha.
TAMAlpha
¶ Bases:
tamcolors.tam.tam_loop.TAMFrame
-
draw
(tam_surface, loop_data, *args)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
update
(tam_loop, keys, loop_data, *args)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
tamcolors.examples.alpha.
run
()¶
-
class
tamcolors.examples.clouds.
Clouds
¶ Bases:
tamcolors.tam.tam_loop.TAMFrame
-
draw
(tam_surface, loop_data, *args)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
update
(tam_loop, keys, loop_data, *args)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
tamcolors.examples.clouds.
run
()¶
-
class
tamcolors.examples.colors.
TAMCOLORS
¶ Bases:
tamcolors.tam.tam_loop.TAMFrame
-
draw
(tam_surface, loop_data, *args)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
update
(tam_loop, keys, loop_data, *args)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
tamcolors.examples.colors.
run
()¶
-
tamcolors.examples.connection_multi_player.
run
()¶
-
class
tamcolors.examples.host_multi_player.
HostMultiPlayer
¶ Bases:
tamcolors.tam.tam_loop.TAMFrame
-
draw
(tam_surface, loop_data, other_surfaces, other_data)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
update
(tam_loop, keys, loop_data, other_handlers, other_keys, other_data)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
tamcolors.examples.host_multi_player.
run
()¶
-
class
tamcolors.examples.icon.
BootLogo
¶ Bases:
tamcolors.tam.tam_loop.TAMFrame
-
draw
(tam_surface, loop_data, *args)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
update
(tam_loop, keys, loop_data, *args)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
tamcolors.examples.icon.
run
()¶
-
class
tamcolors.examples.rgb_color.
RGBCOLOR
¶ Bases:
tamcolors.tam.tam_loop.TAMFrame
-
draw
(tam_surface, loop_data, *args)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
update
(tam_loop, keys, loop_data, *args)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
tamcolors.examples.rgb_color.
run
()¶
-
class
tamcolors.examples.tabletennis.
Ball
(tam_surface, way=False)¶ Bases:
object
-
get_y
()¶
-
update
()¶
-
winner
()¶
-
-
class
tamcolors.examples.tabletennis.
Racket
(x, ball, tam_surface, ai=False)¶ Bases:
object
-
update
(key_manager)¶
-
-
class
tamcolors.examples.tabletennis.
TableTennis
¶ Bases:
tamcolors.tam.tam_loop.TAMFrame
-
draw
(tam_surface, loop_data, *args)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
update
(tam_loop, keys, loop_data, *args)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
tamcolors.examples.tabletennis.
run
()¶
-
class
tamcolors.examples.tam_key_manager.
TAMKeyManager
¶ Bases:
tamcolors.tam.tam_loop.TAMFrame
-
draw
(tam_surface, loop_data, *args)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
update
(tam_loop, keys, loop_data, *args)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
tamcolors.examples.tam_key_manager.
run
()¶
-
class
tamcolors.examples.tam_keys.
TAMKeys
¶ Bases:
tamcolors.tam.tam_loop.TAMFrame
-
draw
(tam_surface, loop_data, *args)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
update
(tam_loop, keys, loop_data, *args)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
tamcolors.examples.tam_keys.
run
()¶
-
class
tamcolors.examples.tam_list_surface.
TAMListSurface
¶ Bases:
tamcolors.tam.tam_loop.TAMFrame
-
draw
(tam_surface, loop_data, *args)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
update
(tam_loop, keys, loop_data, *args)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
tamcolors.examples.tam_list_surface.
run
()¶
-
class
tamcolors.examples.tam_loop.
TAMLoopHelloWorld
¶ Bases:
tamcolors.tam.tam_loop.TAMFrame
-
draw
(tam_surface, loop_data, *args)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
update
(tam_loop, keys, loop_data, *args)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
tamcolors.examples.tam_loop.
run
()¶
-
class
tamcolors.examples.tam_print.
TAMPrint
¶ Bases:
tamcolors.tam.tam_loop.TAMFrame
-
draw
(tam_surface, loop_data, *args)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
update
(tam_loop, keys, loop_data, *args)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
tamcolors.examples.tam_print.
run
()¶
-
class
tamcolors.examples.tam_text_box.
TAMPrint
¶ Bases:
tamcolors.tam.tam_loop.TAMFrame
-
draw
(tam_surface, loop_data, *args)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
update
(tam_loop, keys, loop_data, *args)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
tamcolors.examples.tam_text_box.
run
()¶
tamcolors.tam package¶
-
class
tamcolors.tam.tam_loop.
TAMFrame
(fps, char, foreground_color, background_color, min_width=0, max_width=1000, min_height=0, max_height=1000)¶ Bases:
object
-
done
(tam_loop, loop_data, other_handlers, other_data)¶ info: called when TAMLoop is terminating and can only be called once :param tam_loop: TAMLoop :param loop_data: dict :param other_handlers: dict :param other_data: dict :return:
-
draw
(tam_surface, loop_data, other_surfaces, other_data)¶ info: will draw frame onto terminal :param tam_surface: TAMSurface :param loop_data: object :param other_surfaces: dict :param other_data: dict :return:
-
frame_done
(tam_loop, loop_data, other_handlers, other_data)¶ info: called when clean up the frame and can only be called once :param tam_loop: TAMLoop :param loop_data: dict :param other_handlers: dict :param other_data: dict :return:
-
get_defaults
()¶ info: gets defaults :return: (str, int, int)
-
get_fps
()¶ info: returns the frame fps :return: int
-
get_height_min_and_max
()¶ info: returns min and max height :return: (int, int)
-
get_width_min_and_max
()¶ info: returns min and max width :return: (int, int)
-
make_surface_ready
(tam_surface, screen_width, screen_height)¶ info: will make surface ready for frame :param tam_surface: TAMSurface :param screen_width: int: 0 - inf :param screen_height: int: 0 - inf :return:
-
update
(tam_loop, keys, loop_data, other_handlers, other_keys, other_data)¶ info: will update terminal :param tam_loop: TAMLoop :param keys: list, tuple :param loop_data: objects :param other_handlers: dict :param other_keys: dict :param other_data: dict :return:
-
-
class
tamcolors.tam.tam_loop.
TAMLoop
(tam_frame, io=None, only_any_os=False, color_change_key=('ESCAPE', 'SPECIAL'), loop_data=None, stability_check=False, tam_color_defaults=True, highest_mode_lock=False, preferred_mode=None, name=None, identifier_id=None, start_data=None, receivers=None, other_handlers=None, thread_count=20, enable_loop_log=False, loop_log_key=('F1', 'SPECIAL'), loop_log_level=10, enable_loop_fps=True, loop_fps_key=('F2', 'SPECIAL'))¶ Bases:
tamcolors.tam.tam_loop_io_handler.TAMLoopIOHandler
-
add_frame_stack
(frame)¶ info: will add a TAMFrame to stack :param frame: TAMFrame :return:
-
add_receiver
(receiver)¶
-
done
()¶ info: will stop tam loop :return: None
-
get_all_receiver_names
()¶
-
get_receiver_settings
()¶ info: gets the receiver settings :return: dict
-
pop_frame_stack
()¶ info: will remove TAMFrame from stack :return: TAMFrame or None
-
remove_receiver
(receiver_name)¶
-
classmethod
run_application
(*args, **kwargs)¶ info: will run tam loop as an application note: when tam loop is done running the program will quit if tam loop has an error and the frame does not catch it the error will be printed onto the screen and the program will quit after user input :param args: :param kwargs: :return:
-
thread_task
(func, *args, **kwargs)¶
-
-
exception
tamcolors.tam.tam_loop.
TAMLoopError
¶ Bases:
Exception
-
class
tamcolors.tam.tam_loop_io_handler.
TAMLoopIOHandler
(io, name=None, identifier_id=None, color_change_key=('ESCAPE', 'SPECIAL'), start_data=None, loop_data=None, tam_color_defaults=True, highest_mode_lock=False, preferred_mode=None, reset_io=True)¶ Bases:
object
-
done
()¶ info: will stop tam loop :return: None
-
enable_key_state_mode
(enable=True)¶ info: Will enable or disable key state mode :param enable: bool :return: None
-
freeze_handler
()¶ info: will freeze event loop :return:
-
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: RGBA
-
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: Will get the dimensions of the terminal :return: tuple
-
get_full_name
()¶ info: get full name :return: tuple
-
get_identifier_id
()¶ info: get identifier id :return: bytes or None
-
get_io
()¶ infl: will get the IO :return: IO
-
get_keyboard_name
(default_to_us_english=True)¶ info: Will get the keyboard language name :param default_to_us_english: bool :return: str
-
get_loop_data
()¶ info: get loop data :return: object
-
get_name
()¶ info: get name :return: str or None
-
get_start_data
()¶ info: get start data :return: object
-
is_key_state_mode_enabled
()¶ info: Will get the status of key_state :return: bool
-
is_running
()¶ info: None has not ran, True is running, False has ran :return: bool or None
-
pump_keys
()¶ info: will get keys from the key queue :return: list
-
reset_colors_to_console_defaults
()¶ info: will reset colors to console defaults :return: None
-
run
()¶ info: will call tam loop :return: None
-
run_with_profiler
()¶ info: will run with a profiler and print out data when done :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_loop_data
(loop_data)¶ info: set loop data :param loop_data: object :return: None
-
set_start_data
(start_data)¶ info: set start data :param start_data: object :return: None
-
set_tam_color_defaults
()¶ info: will set console colors to tam defaults :return: None
-
unfreeze_handler
()¶ info: will unfreeze event loop :return:
-
-
class
tamcolors.tam.tam_loop_io_tcp_handler.
TAMLoopIOTCPHandler
(io, name=None, identifier_id=None, color_change_key=('ESCAPE', 'SPECIAL'), start_data=None, loop_data=None, tam_color_defaults=True, highest_mode_lock=False, preferred_mode=None, reset_io=True)¶ Bases:
tamcolors.tam.tam_loop_io_handler.TAMLoopIOHandler
-
done
()¶ info: will stop tam loop :return: None
-
is_running
()¶ info: None has not ran, True is running, False has ran :return: bool or None
-
-
class
tamcolors.tam.tam_loop_receiver.
TAMLoopReceiver
(name)¶ Bases:
abc.ABC
-
done
()¶ info: Will stop the receiver :return: None
-
get_handler
()¶ info: Will get an io if available :return: TAMLoopIOHandler or None
-
get_name
()¶ info: Will get the receiver name :return: str
-
get_receiver_settings
()¶ info: will get the receiver io settings :return: dict or None
-
get_running
()¶ info: Checks if receiver is running :return: bool
-
set_receiver_settings
(settings)¶ info: will set the receiver io settings :param settings: dict :return: None
-
-
class
tamcolors.tam.tam_loop_tcp_receiver.
TAMLoopTCPReceiver
(host='127.0.0.1', port=4444, ipv6=False, listen_count=10, connection_password='', address_white_list=None, address_black_list=None, encryption=None, object_packer=None, our_information=None)¶ Bases:
tamcolors.tam.tam_loop_receiver.TAMLoopReceiver
-
done
()¶ info: Will stop the receiver :return: None
-
get_handler
()¶ info: Will get an io if available :return: TAMLoopIOHandler or None
-
tamcolors.tam_io package¶
-
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
-
-
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
-
-
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
-
-
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
-
classmethod
-
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
-
classmethod
-
exception
tamcolors.tam_io.io_tam.
TAMSoundError
¶ Bases:
Exception
-
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)
-
-
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
¶
-
classmethod
-
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
-
-
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
-
classmethod
-
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
-
-
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
-
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
-
-
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.
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
Bases:
tamcolors.tam_io.tam_drivers.TAMDriver
,abc.ABC
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
-
-
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
-
Bases:
tamcolors.tam_io.tam_drivers.TAMDriver
,abc.ABC
info: checks that io is stable in current environment :return: bool
tamcolors.tam_tools package¶
-
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.
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
-
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
-
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.
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_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.
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:
-
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
-
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:
-
tamcolors.tests package¶
-
class
tamcolors.tests.tam_io_tests.any_drivers_tests.
AnyIOTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test_events
()¶
-
test_get_dimensions
()¶
-
test_get_io
()¶
-
test_get_key
()¶
-
test_get_keyboard_name
()¶
-
test_get_modes
()¶
-
static
test_reset_colors_to_console_defaults
()¶
-
test_set_slash_get_mode
()¶
-
static
test_set_tam_color_defaults
()¶
-
static
test_snapshot
()¶
-
test_sound
()¶
-
-
tamcolors.tests.tam_io_tests.any_drivers_tests.
get_any_io
()¶
-
class
tamcolors.tests.tam_io_tests.tam_colors_tests.
ColorTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test_color_eq
()¶
-
test_color_eq_2
()¶
-
test_color_eq_3
()¶
-
test_color_init
()¶
-
test_color_init_2
()¶
-
test_color_ne
()¶
-
test_color_ne_2
()¶
-
test_get_property
()¶
-
test_get_property_2
()¶
-
-
class
tamcolors.tests.tam_io_tests.tam_surface_tests.
TAMSurfaceTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test_clear
()¶
-
test_copy
()¶
-
test_copy_2
()¶
-
test_draw_onto
()¶
-
test_draw_onto_2
()¶
-
test_draw_onto_3
()¶
-
test_draw_onto_4
()¶
-
test_draw_onto_5
()¶
-
test_draw_onto_6
()¶
-
test_draw_onto_7
()¶
-
test_draw_onto_8
()¶
-
test_get_cross_rect
()¶
-
test_get_cross_rect_2
()¶
-
test_get_defaults
()¶
-
test_get_dimensions
()¶
-
test_get_dimensions_2
()¶
-
test_get_dimensions_3
()¶
-
test_get_from_raw_spot
()¶
-
test_get_raw_spot
()¶
-
test_get_raw_surface
()¶
-
test_get_raw_surface_2
()¶
-
test_get_spot
()¶
-
test_replace_alpha_chars_1
()¶
-
test_replace_alpha_chars_2
()¶
-
test_replace_alpha_chars_3
()¶
-
test_set_defaults_and_clear
()¶
-
test_set_defaults_and_clear_2
()¶
-
test_set_dimensions_and_clear
()¶
-
test_set_dimensions_and_clear_2
()¶
-
test_set_spot
()¶
-
test_set_spot_2
()¶
-
test_set_spot_3
()¶
-
test_set_spot_4
()¶
-
test_set_spot_5
()¶
-
test_set_spot_6
()¶
-
test_set_spot_7
()¶
-
test_set_spot_8
()¶
-
test_set_spot_9
()¶
-
test_surface_eq
()¶
-
test_surface_eq_2
()¶
-
test_surface_eq_3
()¶
-
test_surface_eq_4
()¶
-
test_surface_eq_5
()¶
-
test_surface_init
()¶
-
test_surface_len
()¶
-
test_surface_len_2
()¶
-
test_surface_len_3
()¶
-
test_surface_len_4
()¶
-
test_surface_ne
()¶
-
test_surface_ne_2
()¶
-
test_surface_ne_3
()¶
-
test_surface_ne_4
()¶
-
test_surface_str
()¶
-
test_surface_str_2
()¶
-
test_surface_str_3
()¶
-
test_to_bytes_from_bytes
()¶
-
-
class
tamcolors.tests.tam_io_tests.win_drivers_tests.
WinDriversTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test__console_color_count
()¶
-
test__draw_16
()¶
-
static
test__draw_2
()¶
-
test__get_buffer_dimension
()¶
-
static
test__print
()¶
-
static
test__print_2
()¶
-
static
test__print_3
()¶
-
test__processes_special_color_1
()¶
-
test__processes_special_color_2
()¶
-
test__processes_special_color_3
()¶
-
test__processes_special_color_4
()¶
-
test__processes_special_color_5
()¶
-
test__processes_special_color_6
()¶
-
test__spot_swap
()¶
-
test_able_to_execute
()¶
-
static
test_close
()¶
-
test_done
()¶
-
test_full_play
()¶
-
test_get_dimensions
()¶
-
test_get_key
()¶
-
test_get_key_2
()¶
-
test_get_key_3
()¶
-
test_get_key_4
()¶
-
test_get_key_5
()¶
-
test_get_key_dict
()¶
-
test_get_keyboard_name
()¶
-
test_get_keyboard_name_2
()¶
-
test_get_keyboard_name_3
()¶
-
test_get_keyboard_name_4
()¶
-
test_get_modes
()¶
-
static
test_play
()¶
-
test_position
()¶
-
test_reset_colors_to_console_defaults
()¶
-
test_rest
()¶
-
test_set_slash_get_mode
()¶
-
test_set_tam_color_defaults
()¶
-
test_start
()¶
-
-
class
tamcolors.tests.tam_io_tests.win_drivers_tests.
WinGlobalsTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test_win_stable
()¶
-
-
tamcolors.tests.tam_io_tests.win_drivers_tests.
get_win_io
()¶
-
class
tamcolors.tests.tam_tests.tam_loop_tcp_receiver_tests.
TAMLoopTCPReceiver
(methodName='runTest')¶ Bases:
tamcolors.tests.test_multi_task_helper.MultiTaskHelper
,unittest.case.TestCase
-
test_loop_tcp_receiver
()¶
-
-
class
tamcolors.tests.tam_tests.tam_loop_tests.
TAMFrameTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test__done
()¶
-
test__done_2
()¶
-
test__frame_done
()¶
-
test__frame_done_2
()¶
-
test_draw
()¶
-
test_frame_init
()¶
-
test_get_defaults
()¶
-
test_get_defaults_2
()¶
-
test_get_fps
()¶
-
test_get_fps_2
()¶
-
test_get_height_min_and_max
()¶
-
test_get_height_min_and_max_2
()¶
-
test_get_width_min_and_max
()¶
-
test_get_width_min_and_max_2
()¶
-
test_make_surface_ready
()¶
-
test_make_surface_ready_2
()¶
-
test_make_surface_ready_3
()¶
-
test_update
()¶
-
-
class
tamcolors.tests.tam_tests.tam_loop_tests.
TAMLoopTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test_loop_init
()¶
-
test_preferred_mode
()¶
-
test_preferred_mode_2
()¶
-
test_preferred_mode_3
()¶
-
test_reset_colors_to_console_defaults
()¶
-
test_run
()¶
-
test_set_tam_color_defaults
()¶
-
test_stack
()¶
-
-
class
tamcolors.tests.tam_tools_tests.tam_color_palette_tests.
TAMColorPaletteTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test_get_color
()¶
-
test_get_color_2
()¶
-
test_get_color_3
()¶
-
test_get_rule
()¶
-
test_get_rule_2
()¶
-
test_getitem
()¶
-
test_getitem_2
()¶
-
test_getitem_3
()¶
-
test_init_color_palette
()¶
-
test_init_color_palette_2
()¶
-
test_key_present
()¶
-
test_key_present_2
()¶
-
test_set_color
()¶
-
test_set_color_2
()¶
-
test_set_color_3
()¶
-
test_set_rule
()¶
-
test_set_rule_2
()¶
-
test_setitem
()¶
-
test_setitem_2
()¶
-
test_setitem_3
()¶
-
test_str
()¶
-
test_str_2
()¶
-
test_update
()¶
-
-
class
tamcolors.tests.tam_tools_tests.tam_film_tests.
TAMFilmTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test_append
()¶
-
test_done
()¶
-
test_done_2
()¶
-
test_done_3
()¶
-
test_get
()¶
-
test_get_2
()¶
-
test_get_3
()¶
-
test_get_circular
()¶
-
test_get_circular_2
()¶
-
test_getitem
()¶
-
test_getitem_2
()¶
-
test_getitem_3
()¶
-
test_init_film
()¶
-
test_len
()¶
-
test_len_2
()¶
-
test_next
()¶
-
test_next_2
()¶
-
test_peak
()¶
-
test_peak_2
()¶
-
test_peak_3
()¶
-
test_pop
()¶
-
test_set
()¶
-
test_set_2
()¶
-
test_set_3
()¶
-
test_set_circular
()¶
-
test_setitem
()¶
-
test_setitem_2
()¶
-
test_setitem_3
()¶
-
test_slide
()¶
-
test_slide_2
()¶
-
-
class
tamcolors.tests.tam_tools_tests.tam_key_manager_tests.
TAMKeyManagerTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
get_raw_user_input_2
()¶
-
get_raw_user_input_3
()¶
-
test_get_key_state
()¶
-
test_get_key_state_2
()¶
-
test_get_raw_user_input
()¶
-
test_get_user_input
()¶
-
test_get_user_input_2
()¶
-
test_get_user_input_3
()¶
-
test_get_user_input_generator
()¶
-
test_get_user_input_generator_2
()¶
-
test_get_user_input_generator_3
()¶
-
test_init_key_manger
()¶
-
test_iter
()¶
-
test_silent_key_state
()¶
-
test_silent_key_state_2
()¶
-
test_silent_key_state_3
()¶
-
test_update
()¶
-
test_update_2
()¶
-
-
class
tamcolors.tests.tam_tools_tests.tam_placing_tests.
TAMPlacingTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test__get_center
()¶
-
test__get_center_2
()¶
-
test__get_dimensions_wrapper
()¶
-
test__get_dimensions_wrapper_2
()¶
-
test__get_dimensions_wrapper_3
()¶
-
test__get_other_side
()¶
-
test__get_other_side_2
()¶
-
test_bottom_left
()¶
-
test_bottom_left_2
()¶
-
test_bottom_right
()¶
-
test_bottom_right_2
()¶
-
test_center
()¶
-
test_center_2
()¶
-
test_top_left
()¶
-
test_top_left_2
()¶
-
test_top_right
()¶
-
test_top_right_2
()¶
-
-
class
tamcolors.tests.tam_tools_tests.tam_text_box_tests.
TAMTextBoxTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test_done
()¶
-
test_done_2
()¶
-
test_draw
()¶
-
test_draw_2
()¶
-
test_draw_3
()¶
-
test_get_char
()¶
-
test_get_char_2
()¶
-
test_get_colors
()¶
-
test_get_colors_2
()¶
-
test_get_dimensions
()¶
-
test_get_dimensions_2
()¶
-
test_get_text
()¶
-
test_get_text_2
()¶
-
test_set_char
()¶
-
test_set_char_2
()¶
-
test_set_colors
()¶
-
test_set_colors_2
()¶
-
test_set_colors_3
()¶
-
test_tam_text_box_init
()¶
-
test_tam_text_box_str
()¶
-
test_tam_text_box_str_2
()¶
-
test_update
()¶
-
-
class
tamcolors.tests.tests_tests.test_multi_task_helper_tests.
MultiTaskHelperTests
(methodName='runTest')¶ Bases:
tamcolors.tests.test_multi_task_helper.MultiTaskHelper
,unittest.case.TestCase
-
test_assert_no_main_process
()¶
-
test_assert_no_main_thread
()¶
-
test_assert_process
()¶
-
test_assert_thread
()¶
-
test_hand_down
()¶
-
-
class
tamcolors.tests.utils_tests.immutable_cache_tests.
DummyCache
(*args, **kwargs)¶
-
class
tamcolors.tests.utils_tests.object_packer_tests.
FastHandObjectPackerTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test_dunder_bytes
()¶
-
test_tam_color_1
()¶
-
test_tam_color_2
()¶
-
test_tam_surface_1
()¶
-
test_tam_surface_2
()¶
-
-
class
tamcolors.tests.utils_tests.object_packer_tests.
ObjectPackerFunctionsTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test_save_and_load_data_1
()¶
-
test_save_and_load_data_2
()¶
-
test_save_and_load_data_3
()¶
-
test_save_and_load_data_4
()¶
-
test_save_and_load_int_1
()¶
-
test_save_and_load_int_2
()¶
-
test_save_and_load_int_3
()¶
-
test_save_and_load_int_4
()¶
-
-
class
tamcolors.tests.utils_tests.object_packer_tests.
ObjectPackerJsonTests
(methodName='runTest')¶ Bases:
unittest.case.TestCase
-
test_bool
()¶
-
test_bytearray
()¶
-
test_bytes
()¶
-
test_dict
()¶
-
test_fast_hand_object
()¶
-
test_float
()¶
-
test_int
()¶
-
test_large_data
()¶
-
test_list
()¶
-
test_none
()¶
-
test_set
()¶
-
test_str
()¶
-
test_tuple
()¶
-
-
class
tamcolors.tests.utils_tests.tcp_tests.
TCPObjectWrapper
(methodName='runTest')¶ Bases:
tamcolors.tests.test_multi_task_helper.MultiTaskHelper
,unittest.case.TestCase
-
test_object_wrapper
()¶
-
-
class
tamcolors.tests.utils_tests.tcp_tests.
TCPTests
(methodName='runTest')¶ Bases:
tamcolors.tests.test_multi_task_helper.MultiTaskHelper
,unittest.case.TestCase
-
test_ping
()¶
-
test_ping_ipv6
()¶
-
-
tamcolors.tests.all_tests.
load_tests
(loader, other_tests=None, pattern=None)¶
-
tamcolors.tests.all_tests.
stability_check
(ret_bool=True, run_slow=False)¶ info: run all TAM tests :param ret_bool: bool :param run_slow: bool :return: (int, int) or bool: (test_pasted, test_ran) or True if all test pasted
-
tamcolors.tests.all_tests.
tests_main
(run_slow=False)¶ info: the main way tamcolors run tests :param run_slow: bool: will run slow tests :return: bool
-
class
tamcolors.tests.test_multi_task_helper.
MultiTaskHelper
¶ Bases:
object
-
multiple_processes_helper
(tasks, timeout=120)¶ info: will run tasks in a thread :param tasks: list or tuple: [(func, tuple, dict), …] :param timeout: int :return:
-
multiple_threads_helper
(tasks, timeout=120)¶ info: will run tasks in a thread :param tasks: list or tuple: [(func, tuple, dict), …] :param timeout: int :return:
-
classmethod
task
(func, *args, **kwargs)¶ info: will make a Task :param func: Function :param args: tuple :param kwargs: dict :return: Task
-
-
tamcolors.tests.test_multi_task_helper.
process_runner
(error_ret, func, *args, **kwargs)¶ info: will run the task :param error_ret: list: away to return an error :param func: function :param args: tuple :param kwargs: dict :return:
-
tamcolors.tests.test_utils.
enable_slow_tests
(enable=True)¶ info: will enable slow tests :param enable: bool :return:
-
tamcolors.tests.test_utils.
is_slow_tests_enabled
()¶ info: will check iif slow tests are enabled :return: bool
-
tamcolors.tests.test_utils.
slow_test
(function)¶ info: slow_test decorators :param function: function :return: function
tamcolors.utils package¶
-
tamcolors.utils.compress.
compress
(data)¶ info: will compress data :param data: bytes :return: bytes
-
tamcolors.utils.compress.
decompress
(data)¶ info: will defcompress data :param data: bytes :return: bytes
-
class
tamcolors.utils.encryption.
Encryption
(rsa_key_size=4096, aes_key_size=256, nonce_key_size=64, authenticator=b'', max_random=20)¶ Bases:
object
-
static
check_sandy_check_key
(sandy_key, data)¶ info: Checks if the sandy key is equal to the data key. :param sandy_key: bytes: sha hash key :param data: bytes: :return: bool
-
decrypt
(data)¶ info: Decrypt message. The data will also be checked for corruption. :param data: bytes :return: bytes: Unencrypted data.
-
encrypt
(data)¶ info: Encrypts data. :param data: bytes :return: bytes: Encrypted data.
-
encrypt_with_public_key
(key, data)¶ info: Encrypts data with public key. :param key: bytes or ras key object :param data: bytes :return: bytes: encrypted data
-
get_raw_private_key
()¶ info: Gets the raw private key. :return: bytes: PEM encoding
-
get_raw_public_key
()¶ info: gets the raw public key. :return: bytes: PEM encoding
-
static
make_sandy_check_key
(data)¶ info: Hashes data. :param data: bytes :return: bytes: Hash key.
-
static
-
exception
tamcolors.utils.encryption.
EncryptionError
¶ Bases:
Exception
-
tamcolors.utils.identifier.
generate_identifier_bytes
(identifier_file='/home/docs/checkouts/readthedocs.org/user_builds/tamcolors/checkouts/latest/tamcolors/utils/identifier.id', identifier_size=500)¶
-
tamcolors.utils.identifier.
get_identifier_bytes
(identifier_file='/home/docs/checkouts/readthedocs.org/user_builds/tamcolors/checkouts/latest/tamcolors/utils/identifier.id')¶
-
class
tamcolors.utils.immutable_cache.
ImmutableCache
¶ Bases:
object
-
class
tamcolors.utils.log.
Log
(size=5000)¶ Bases:
object
-
first_msg_id
()¶
-
last_msg_id
()¶
-
log
(msg)¶
-
read
(log_id)¶
-
-
tamcolors.utils.log.
critical
(msg)¶ info: log at critical level :param msg: str :return:
-
tamcolors.utils.log.
debug
(msg)¶ info: log at debug level :param msg: str :return:
-
tamcolors.utils.log.
disable_logging
()¶ info: will disable logging :return:
-
tamcolors.utils.log.
enable_logging
(level=10)¶ info: will enable logging at a level :param level: log level :return:
-
tamcolors.utils.log.
error
(msg)¶ info: log at debug level :param msg: str :return:
-
tamcolors.utils.log.
format_message
(func)¶
-
tamcolors.utils.log.
info
(msg)¶ info: log at info level :param msg: str :return:
-
tamcolors.utils.log.
warning
(msg)¶ info: log at warning level :param msg: str :return:
-
class
tamcolors.utils.object_packer.
FastHandObjectPacker
¶ Bases:
object
-
classmethod
from_bytes
(object_byte_array)¶ info: from bytes to object :param object_byte_array: bytearray :return: object
-
classmethod
start_from_bytes
(object_bytes)¶ info: from bytes to object :param object_bytes: bytearray, bytes, list, tuple :return: object
-
to_bytes
()¶ info: object to bytes :return: bytes
-
classmethod
-
class
tamcolors.utils.object_packer.
ObjectPackerJson
(fast_hand_object_packer_objects=None)¶ Bases:
object
-
dumps
(data)¶ info: object to bytes :param data: object :return: bytes
-
loads
(data)¶ info: bytes to object :param data: bytearray, bytes, list, tuple :return: object
-
-
exception
tamcolors.utils.object_packer.
ObjectPackerJsonError
¶ Bases:
Exception
-
tamcolors.utils.object_packer.
load_data
(object_byte_array)¶ info: Loads bytes :param object_byte_array: bytearray :return: bytes
-
tamcolors.utils.object_packer.
load_int
(object_byte_array)¶ info: Loads an unsigned int :param object_byte_array: bytearray :return: int
-
tamcolors.utils.object_packer.
save_data
¶ info: Saves bytes :param data: bytes :return: bytes
-
tamcolors.utils.object_packer.
save_int
¶ info: Saves an unsigned int :param number: int :return: bytes
-
class
tamcolors.utils.tcp.
TCPBase
(connection, address, port, connection_password, encryption=None, object_packer=None, our_information=None)¶ Bases:
object
-
close
()¶ info: will close the connection :return: None
-
get_address
()¶ info: will get the address :return: str
-
get_data
()¶ info: will compress and encrypt data if encryption is enabled :return: bytes
-
is_open
()¶ info: will check if connection is open :return: bool
-
send_data
(data)¶ info: will compress and decrypt if encryption is enabled :param data: bytes :return: None
-
-
class
tamcolors.utils.tcp.
TCPConnection
(host='127.0.0.1', port=4444, ipv6=False, connection_password='', user_name=None, user_id=None, encryption=None, object_packer=None, our_information=None)¶ Bases:
tamcolors.utils.tcp.TCPBase
-
get_other_data
()¶ info: will get other data :return: object
-
-
exception
tamcolors.utils.tcp.
TCPError
¶ Bases:
Exception
-
class
tamcolors.utils.tcp.
TCPHost
(*args, **kwargs)¶ Bases:
tamcolors.utils.tcp.TCPBase
-
get_other_data
()¶ info: will get other data :return: object
-
get_user_id
()¶ info: get connection id :return: bytes
-
get_user_name
()¶ info: get connection name :return: str
-
-
class
tamcolors.utils.tcp.
TCPObjectConnector
(tcp_connection, object_packer=None, no_return=None, optimizer=None, none_generator=None)¶ Bases:
object
-
close
()¶ info: will close the object :return:
-
get_connection
()¶ info: will get connection :return: TCPBase
-
is_open
()¶ info: will check if object is still open :return: bool
-
-
class
tamcolors.utils.tcp.
TCPObjectWrapper
(tcp_connection, obj, object_packer=None)¶ Bases:
object
-
close
()¶ info: will close the object :return:
-
get_connection
()¶ info: will get connection :return: TCPBase
-
is_open
()¶ info: will check if object is still open :return: bool
-
-
class
tamcolors.utils.tcp.
TCPReceiver
(host='127.0.0.1', port=4444, ipv6=False, listen_count=10, connection_password='', address_white_list=None, address_black_list=None, encryption=None, object_packer=None, our_information=None)¶ Bases:
object
-
close
()¶ info: will close tcp receiver connection :return: None
-
get_host_connection
(wait=True)¶ info: will get a new host connection :param wait: bool: if true will wait for a connection :return: None or TCPHost
-
-
class
tamcolors.utils.transport_optimizer.
LastReceivedCache
¶ Bases:
object
-
class
tamcolors.utils.transport_optimizer.
LastSentCache
¶ Bases:
object