2021-03-12 18:06:05 +01:00
|
|
|
import time
|
2021-08-05 14:21:42 +02:00
|
|
|
from cpl_core.console import Console, ForegroundColorEnum
|
2021-03-12 18:06:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_spinner():
|
2022-12-03 23:30:54 +01:00
|
|
|
Console.write_line('test1')
|
|
|
|
Console.write_line('test2', 2)
|
|
|
|
Console.write_line('test3', 2, 3)
|
|
|
|
Console.write_line('test4', 2, 3, 4)
|
2021-03-15 20:33:20 +01:00
|
|
|
time.sleep(2)
|
2022-12-03 23:30:54 +01:00
|
|
|
Console.write_line('test5')
|
2021-03-12 18:06:05 +01:00
|
|
|
|
|
|
|
|
2021-03-29 13:25:15 +02:00
|
|
|
def test_console():
|
|
|
|
Console.write_line('Hello World')
|
|
|
|
Console.write('\nName: ')
|
|
|
|
Console.write_line(' Hello', Console.read_line())
|
|
|
|
Console.clear()
|
|
|
|
Console.write_at(5, 5, 'at 5, 5')
|
|
|
|
Console.write_at(10, 10, 'at 10, 10')
|
|
|
|
|
|
|
|
|
2021-03-12 18:06:05 +01:00
|
|
|
if __name__ == '__main__':
|
2021-03-15 20:06:34 +01:00
|
|
|
Console.write_line('Hello World\n')
|
2022-12-03 23:30:54 +01:00
|
|
|
Console.spinner('Test:', test_spinner, spinner_foreground_color=ForegroundColorEnum.cyan, text_foreground_color='green')
|
|
|
|
# opts = [
|
|
|
|
# 'Option 1',
|
|
|
|
# 'Option 2',
|
|
|
|
# 'Option 3',
|
|
|
|
# 'Option 4'
|
|
|
|
# ]
|
|
|
|
# selected = Console.select(
|
|
|
|
# '>',
|
|
|
|
# 'Select item:',
|
|
|
|
# opts,
|
|
|
|
# header_foreground_color=ForegroundColorEnum.blue,
|
|
|
|
# option_foreground_color=ForegroundColorEnum.green,
|
|
|
|
# cursor_foreground_color=ForegroundColorEnum.red
|
|
|
|
# )
|
|
|
|
# Console.write_line(f'You selected: {selected}')
|
|
|
|
# # test_console()
|
|
|
|
#
|
|
|
|
# Console.write_line()
|