added temp title
This commit is contained in:
parent
cbc9d80188
commit
ac8653783d
@ -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'
|
||||||
@ -35,19 +38,22 @@ class Menu:
|
|||||||
|
|
||||||
for i, option in enumerate(self.options):
|
for i, option in enumerate(self.options):
|
||||||
print(f'{put_cursor(self.start_line + i, 0)}\033[2;0;0m', end='')
|
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:
|
if i == self.selected:
|
||||||
print(f'{self.highlight}•{option}')
|
print(f'{self.highlight}• {option}')
|
||||||
else:
|
else:
|
||||||
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:
|
||||||
|
Loading…
Reference in New Issue
Block a user