-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
54 lines (52 loc) · 1.78 KB
/
utils.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
def choiceMenu(choices, message):
goodselection = False
while goodselection == False:
choiceNumber = 0
print("+++++++++++++++++++++++++++++++")
print(message)
for c in choices:
choiceNumber+=1
print(str(choiceNumber) + ": " + c)
snq = choiceNumber + 1
q = choiceNumber + 2
print(str(snq) + ": SAVE AND QUIT")
print(str(q) + ": QUIT")
try:
selection = input("ENTER A NUMERIC VALUE: ")
sn = int(selection)
if sn == snq:
return "saveandquit", "saveandquit"
if sn == q:
return "quit", "quit"
choice = str(choices[sn-1])
goodselection = True
except:
print("PLEASE SELECT A SHOWN NUMERIC VALUE")
return choice, sn
def enterText(message):
goodInput = False
while goodInput == False:
print("+++++++++++++++++++++++++++++++")
print(message + ": ")
print("1: SAVE AND QUIT")
print("2: QUIT")
userInput = raw_input("ENTER CHOICE: ")
if userInput.strip() == "1":
return userInput.strip(), "saveandquit"
if userInput.strip() == "2":
return userInput.strip(), "quit"
if userInput.strip() == "":
print("PLEASE ENTER A VALUE")
else:
print("good age")
goodInput = True
return userInput.strip(), "good"
def chooseMultiStepChar(character, attribute, choices, rounds, message):
char = character
i = 0
value = ""
while i<rounds and value != "quit" and value != "saveandquit":
selection, value = choiceMenu(choices, message + ": " + str(i+1) + "/" + str(rounds))
char[attribute].append(selection)
i+=1
return char, value