cpl.console¶
cpl.console.background_color_enum¶
cpl.console.console¶
-
class
cpl.console.console.
Console
¶ Bases:
object
Useful functions for handling with input and output
-
background_color
= 'on_default'¶
Prints the string as a banner :param string: :return:
-
classmethod
clear
()¶ Clears the console :return:
-
classmethod
close
()¶ Close the application :return:
-
classmethod
color_reset
()¶ Resets color :return:
-
classmethod
disable
()¶ Disable console interaction :return:
-
classmethod
enable
()¶ Enable console interaction :return:
-
classmethod
error
(string: str, tb: Optional[str] = None)¶ Prints an error with traceback :param string: :param tb: :return:
-
foreground_color
= 'default'¶
-
classmethod
read
(output: Optional[str] = None) → str¶ Read in line :param output: :return:
-
classmethod
read_line
(output: Optional[str] = None) → str¶ Reads in next line :param output: :return:
-
classmethod
reset_cursor_position
()¶ Resets cursor position :return:
-
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 :param char: :param message: :param options: :param header_foreground_color: :param header_background_color: :param option_foreground_color: :param option_background_color: :param cursor_foreground_color: :param cursor_background_color: :return: Selected option as str
-
classmethod
set_background_color
(color: Union[cpl.console.background_color_enum.BackgroundColorEnum, str])¶ Sets the background color :param color: :return:
-
classmethod
set_cursor_position
(x: int, y: int)¶ Sets cursor position :param x: :param y: :return:
-
classmethod
set_foreground_color
(color: Union[cpl.console.foreground_color_enum.ForegroundColorEnum, str])¶ Sets the foreground color :param color: :return:
-
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 :param message: :param call: :param args: :param text_foreground_color: :param spinner_foreground_color: :param text_background_color: :param spinner_background_color: :param kwargs: :return: Return value of call
-
classmethod
table
(header: list, values: list)¶ Prints a table with header and values :param header: :param values: :return:
-
classmethod
write
(*args, end='')¶ Prints in active line :param args: :param end: :return:
-
classmethod
write_at
(x: int, y: int, *args)¶ Prints at given position :param x: :param y: :param args: :return:
-
classmethod
write_line
(*args)¶ Prints to new line :param args: :return:
-
classmethod
write_line_at
(x: int, y: int, *args)¶ Prints new line at given position :param x: :param y: :param args: :return:
-
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.Thread
-
exit
()¶ Stops the spinner :return:
-
run
() → None¶ Entry point of thread, shows the spinner :return:
-
stop_spinning
()¶ Stops the spinner :return:
-