From d600b78d02a85283a2521b9e4d282b3a85f3d798 Mon Sep 17 00:00:00 2001 From: Calum Andrew Morrell Date: Mon, 19 May 2025 13:47:10 +0100 Subject: [PATCH] Started adding class to handle menu display and selection. --- dg_clt/menus.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 dg_clt/menus.py diff --git a/dg_clt/menus.py b/dg_clt/menus.py new file mode 100644 index 0000000..2ff9f57 --- /dev/null +++ b/dg_clt/menus.py @@ -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()