You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
736 B
Python

from typing import List
import os
from .screen import Screen
class TerminalScreen(Screen):
def __init__(self):
self.type = "Terminal Screen"
self.width, self.height = os.get_terminal_size()
def displayLines(self, lines: List[str], x_padding: int = 0, y_padding: int = 4):
# displays text on the screen
self.clearScreen()
y = 0
x = 0
for i, line in enumerate(lines):
# TODO: Calculate x and y before printing to check if we are going to go off the terminal
print('\n' * int(y+(y_padding*i)), end='')
print(' ' * int(x+(x_padding*i)), end='')
print(line, end='')
def clearScreen(self):
print("\033c", end='')