Added a method to display the menu, get & validate input, and return the input.
parent
45dc57de97
commit
9ff0d25227
|
|
@ -1,4 +1,4 @@
|
||||||
from screen import clear
|
from dg_clt.screen import clear
|
||||||
|
|
||||||
|
|
||||||
class Menu:
|
class Menu:
|
||||||
|
|
@ -17,4 +17,10 @@ class Menu:
|
||||||
print(f'{key}: {value}')
|
print(f'{key}: {value}')
|
||||||
else:
|
else:
|
||||||
print()
|
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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue