added temp title

This commit is contained in:
Nicholas Dyer 2023-12-21 12:43:38 -05:00
parent cbc9d80188
commit ac8653783d
Signed by: ndyer
GPG Key ID: E5426C53DE17E1B2

View File

@ -2,6 +2,9 @@ import keyboard
import time import time
import os import os
HIGHLIGHTED = '\033[38;5;0m\033[48;5;2m'
REGULAR = '\033[38;5;2m'
def put_cursor(line, col): def put_cursor(line, col):
return f'\033[{int(line)};{int(col)}f' return f'\033[{int(line)};{int(col)}f'
@ -42,12 +45,15 @@ class Menu:
print(f'{self.regular}{option}') print(f'{self.regular}{option}')
def main(): def main():
os.system('clear') os.system('clear')
print('\033[?25l', end='\r') os.system('stty -echo')
print('\033[8m', end='\r') term_size = os.get_terminal_size()
selected_item = 0
print('\033[?25l', end='')
title = '[Interactive Text Menu]'
title_col_start = int((term_size.columns / 2) - (len(title) / 2))
print(f'{put_cursor(0, title_col_start)}{REGULAR}{title}', end='\n')
menu = Menu(10) menu = Menu(10)
menu.draw() menu.draw()
while True: while True: