21 lines
553 B
Python
21 lines
553 B
Python
from screen import clear
|
|
|
|
|
|
class Menu:
|
|
|
|
def __init__(self, title: str, menu_items: dict[str, str], selection: str = '> '):
|
|
self.title: str = title
|
|
self.menu_items: dict[str, str] = menu_items
|
|
self.selection: str = selection
|
|
|
|
def display(self):
|
|
clear()
|
|
print(self.title)
|
|
print(f'{'-' * len(self.title)}\n')
|
|
for key, value in self.menu_items.items():
|
|
if key:
|
|
print(f'{key}: {value}')
|
|
else:
|
|
print()
|
|
print(f'\n{self.selection}')
|