cpl.console¶
cpl.console.background_color_enum¶
cpl.console.console¶
- 
class 
cpl.console.console.Console¶ Bases:
objectUseful functions for handling with input and output
- 
background_color= 'on_default'¶ 
Prints the string as a banner
- string: 
str Message to print as banner
- string: 
 
- 
classmethod 
clear()¶ Clears the console
- 
classmethod 
close()¶ Closes the application
- 
classmethod 
color_reset()¶ Resets the color settings
- 
classmethod 
disable()¶ Disables console interaction
- 
classmethod 
enable()¶ Enables console interaction
- 
classmethod 
error(string: str, tb: Optional[str] = None)¶ Prints an error with traceback
- string: 
str Error message
- tb: 
str Error traceback
- string: 
 
- 
foreground_color= 'default'¶ 
- 
classmethod 
read(output: Optional[str] = None) → str¶ Reads in line
- output: 
str String to print before input
input()
- output: 
 
- 
classmethod 
read_line(output: Optional[str] = None) → str¶ Reads in next line
- output: 
str String to print before input
input()
- output: 
 
- 
classmethod 
reset_cursor_position()¶ Resets cursor position
- 
classmethod 
select(char: str, message: str, options: list, header_foreground_color: Union[str, cpl.console.foreground_color_enum.ForegroundColorEnum] = <ForegroundColorEnum.default: 'default'>, header_background_color: Union[str, cpl.console.background_color_enum.BackgroundColorEnum] = <BackgroundColorEnum.default: 'on_default'>, option_foreground_color: Union[str, cpl.console.foreground_color_enum.ForegroundColorEnum] = <ForegroundColorEnum.default: 'default'>, option_background_color: Union[str, cpl.console.background_color_enum.BackgroundColorEnum] = <BackgroundColorEnum.default: 'on_default'>, cursor_foreground_color: Union[str, cpl.console.foreground_color_enum.ForegroundColorEnum] = <ForegroundColorEnum.default: 'default'>, cursor_background_color: Union[str, cpl.console.background_color_enum.BackgroundColorEnum] = <BackgroundColorEnum.default: 'on_default'>) → str¶ Prints select menu
- char: 
str Character to show which element is selected
- message: 
str Message or header of the selection
- options: List[
str] Selectable options
- header_foreground_color: Union[
str,cpl.console.foreground_color_enum.ForegroundColorEnum] Foreground color of the header
- header_background_color: Union[
str,cpl.console.background_color_enum.BackgroundColorEnum] Background color of the header
- option_foreground_color: Union[
str,cpl.console.foreground_color_enum.ForegroundColorEnum] Foreground color of the options
- option_background_color: Union[
str,cpl.console.background_color_enum.BackgroundColorEnum] Background color of the options
- cursor_foreground_color: Union[
str,cpl.console.foreground_color_enum.ForegroundColorEnum] Foreground color of the cursor
- cursor_background_color: Union[
str,cpl.console.background_color_enum.BackgroundColorEnum] Background color of the cursor
Selected option as
str- char: 
 
- 
classmethod 
set_background_color(color: Union[cpl.console.background_color_enum.BackgroundColorEnum, str])¶ Sets the background color
- color: Union[
cpl.console.background_color_enum.BackgroundColorEnum,str] Background color of the console
- color: Union[
 
- 
classmethod 
set_cursor_position(x: int, y: int)¶ Sets cursor position
- x: 
int X coordinate
- y: 
int Y coordinate
- x: 
 
- 
classmethod 
set_foreground_color(color: Union[cpl.console.foreground_color_enum.ForegroundColorEnum, str])¶ Sets the foreground color
- color: Union[
cpl.console.background_color_enum.BackgroundColorEnum,str] Foreground color of the console
- color: Union[
 
- 
classmethod 
set_hold_back(value: bool)¶ 
- 
classmethod 
spinner(message: str, call: collections.abc.Callable, *args, text_foreground_color: Optional[Union[str, cpl.console.foreground_color_enum.ForegroundColorEnum]] = None, spinner_foreground_color: Optional[Union[str, cpl.console.foreground_color_enum.ForegroundColorEnum]] = None, text_background_color: Optional[Union[str, cpl.console.background_color_enum.BackgroundColorEnum]] = None, spinner_background_color: Optional[Union[str, cpl.console.background_color_enum.BackgroundColorEnum]] = None, **kwargs) → any¶ Shows spinner and calls given function, when function has ended the spinner stops
- message: 
str Message of the spinner
- call: 
Callable Function to call
- args: 
list Arguments of the function
- text_foreground_color: Union[
str,cpl.console.foreground_color_enum.ForegroundColorEnum] Foreground color of the text
- spinner_foreground_color: Union[
str,cpl.console.foreground_color_enum.ForegroundColorEnum] Foreground color of the spinner
- text_background_color: Union[
str,cpl.console.background_color_enum.BackgroundColorEnum] Background color of the text
- spinner_background_color: Union[
str,cpl.console.background_color_enum.BackgroundColorEnum] Background color of the spinner
- kwargs: 
dict Keyword arguments of the call
Return value of call
- message: 
 
- 
classmethod 
table(header: list, values: list)¶ Prints a table with header and values
- header: List[
str] Header of the table
- values: List[List[
str]] Values of the table
- header: List[
 
- 
classmethod 
write(*args, end='')¶ Prints in active line
- args: 
list Elements to print
- end: 
str Last character to print
- args: 
 
- 
classmethod 
write_at(x: int, y: int, *args)¶ Prints at given position
- x: 
int X coordinate
- y: 
int Y coordinate
- args: 
list Elements to print
- x: 
 
- 
classmethod 
write_line(*args)¶ Prints to new line
- args: 
list Elements to print
- args: 
 
- 
classmethod 
write_line_at(x: int, y: int, *args)¶ Prints new line at given position
- x: 
int X coordinate
- y: 
int Y coordinate
- args: 
list Elements to print
- x: 
 
- 
 
cpl.console.console_call¶
cpl.console.foreground_color_enum¶
cpl.console.spinner_thread¶
- 
class 
cpl.console.spinner_thread.SpinnerThread(msg_len: int, foreground_color: cpl.console.foreground_color_enum.ForegroundColorEnum, background_color: cpl.console.background_color_enum.BackgroundColorEnum)¶ Bases:
threading.ThreadThread to show spinner in terminal
- msg_len: 
int Length of the message
- foreground_color: 
cpl.console.foreground_color.ForegroundColorEnum Foreground color of the spinner
- background_color: 
cpl.console.background_color.BackgroundColorEnum Background color of the spinner
- 
exit()¶ Stops the spinner
- 
run() → None¶ Entry point of thread, shows the spinner
- 
stop_spinning()¶ Stops the spinner
- msg_len: