Started adding class to handle menu display and selection.
parent
5f0be3baae
commit
d600b78d02
|
|
@ -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()
|
||||||
Loading…
Reference in New Issue