-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdemo.py
47 lines (44 loc) · 1.24 KB
/
demo.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
import os
import dumb_menu
def loopmenu():
options = ["[1]happy",
"[2]sad",
"[3]give me a cookie",
"[q]quit"]
index = dumb_menu.get_menu_choice(options,isclean = True)
# clear screen, cls for windows, clear for linux
os.system('cls')
# Python 3.10+ only,old version could use if-else
match index:
case 0:
print(":)")
case 1:
print(":(")
case 2:
print("🍪ヾ(•ω•`)o")
case 3:
exit()
input('Press ENTER to continue...')
# in this case I tried to get the key string, not the index
def loopmenu2():
options = ["[z]happy",
"[x]sad",
"[c]give me a cookie",
"[q]quit"]
index = dumb_menu.get_menu_choice(options,isclean = True,give_key_str = True)
# clear screen, cls for windows, clear for linux
os.system('cls')
# Python 3.10+ only,old version could use if-else
match index:
case "z":
print(":)")
case "x":
print(":(")
case "c":
print("🍪ヾ(•ω•`)o")
case "q":
exit()
input('Press ENTER to continue...')
if __name__ == "__main__":
while True:
loopmenu2()