Added a method to display the menu, get & validate input, and return the input.

main
Calum Andrew Morrell 2025-05-19 14:57:58 +01:00
parent 45dc57de97
commit 9ff0d25227
1 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,4 @@
from screen import clear
from dg_clt.screen import clear
class Menu:
@ -17,4 +17,10 @@ class Menu:
print(f'{key}: {value}')
else:
print()
print(f'\n{self.selection}')
def get_input(self):
while True:
self.display()
user_input = input(f'\n{self.selection}')
if user_input in self.menu_items.keys():
return user_input