Started adding class to handle menu display and selection.

main
Calum Andrew Morrell 2025-05-19 13:47:10 +01:00
parent 5f0be3baae
commit d600b78d02
1 changed files with 19 additions and 0 deletions

19
dg_clt/menus.py Normal file
View File

@ -0,0 +1,19 @@
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()