-
Notifications
You must be signed in to change notification settings - Fork 0
/
menu_example.py
65 lines (51 loc) · 1.78 KB
/
menu_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from simple_list import SimpleList
def main():
_list = SimpleList(True) # if true, window will be cleared on init
data = _list.choose_one(
'Choose an acion', # question
['Register user', 'Edit user', 'Find user'], # alteratives
'answer', # key to access answer - default: 'answer'
True, # also get index of the answer? default: False
'Logout' # go back button? default: Fasle
)
user_options(data, main)
def user_options(data, came_from):
if data['answer'] == 'Register user':
_list = SimpleList(True)
data = _list.choose_one(
'Choose an acion', # question
['alternative 1', 'alternative 2', 'alternative 3'],
'answer',
False,
'Go back'
)
if data['answer'] == 'Go back':
return came_from()
_list.delete_last_lines(7)
print(_list.color.return_colored("ENTER USER & PASS: ", "blue"))
print()
username = input("Enter username: ")
password = input("Enter password: ")
# ... more code ...
# push to database or store in file
elif data['answer'] == 'Edit user':
_list = SimpleList(True)
data = _list.choose_one(
'Choose an acion', # question
['alternative 1', 'alternative 2', 'alternative 3'],
'answer',
False,
'Go back'
)
# ... code ...
elif data['answer'] == 'Find user':
_list = SimpleList(True)
data = _list.choose_one(
'Choose an acion', # question
['alternative 1', 'alternative 2', 'alternative 3'],
'answer',
False,
'Go back'
)
# ... code ...
main()