dg-clt/dg_clt/menus.py

20 lines
516 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('-' * len(self.title) + '\n')
for key, value in self.menu_items.items():
if key:
print(f'{key}: {value}')
else:
print()