added temp title
This commit is contained in:
parent
cbc9d80188
commit
ac8653783d
@ -2,6 +2,9 @@ import keyboard
|
||||
import time
|
||||
import os
|
||||
|
||||
HIGHLIGHTED = '\033[38;5;0m\033[48;5;2m'
|
||||
REGULAR = '\033[38;5;2m'
|
||||
|
||||
|
||||
def put_cursor(line, col):
|
||||
return f'\033[{int(line)};{int(col)}f'
|
||||
@ -35,19 +38,22 @@ class Menu:
|
||||
|
||||
for i, option in enumerate(self.options):
|
||||
print(f'{put_cursor(self.start_line + i, 0)}\033[2;0;0m', end='')
|
||||
print(' ' * term_size.columns, end='\r')
|
||||
print('' * term_size.columns, end='\r')
|
||||
if i == self.selected:
|
||||
print(f'{self.highlight}•{option}')
|
||||
print(f'{self.highlight}• {option}')
|
||||
else:
|
||||
print(f'{self.regular}•{option}')
|
||||
|
||||
print(f'{self.regular}• {option}')
|
||||
|
||||
|
||||
def main():
|
||||
os.system('clear')
|
||||
print('\033[?25l', end='\r')
|
||||
print('\033[8m', end='\r')
|
||||
selected_item = 0
|
||||
os.system('stty -echo')
|
||||
term_size = os.get_terminal_size()
|
||||
|
||||
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.draw()
|
||||
while True:
|
||||
|
Loading…
Reference in New Issue
Block a user