1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
class Screen:
def __init__(self):
print('\033c')
self.screen_size = ScreenSize()
self.cursor = self.Cursor(self)
self.position = self.Position()
self.current_line = 0
self.current_column = 0
class Cursor:
def __init__(self, screen):
self.screen = screen
def up(self, n=1):
print("\x1b[{n}A".format(n=n), end='')
self.screen.current_line -= 1
def down(self, n=1):
print("\x1b[{n}B".format(n=n), end='')
self.screen.current_line += 1
def left(self, n=1):
print("\x1b[{n}C".format(n=n), end='')
self.screen.current_column -= 1
def right(self, n=1):
print("\x1b[{n}D".format(n=n), end='')
self.screen.current_column += 1 |
Partager