-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheadCmdClient.py
More file actions
executable file
·70 lines (59 loc) · 1.54 KB
/
Copy pathheadCmdClient.py
File metadata and controls
executable file
·70 lines (59 loc) · 1.54 KB
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
66
67
68
69
70
#!/usr/bin/env python
# a dumb cmdline client to drive the halloweenhead
# menu:
# options to make the eyes blink, stare, and rest
# options to play various sound fx
# 'scary' ambiance in the background
# note: because I haven't got dmix working with the audio out
# I need to stop and start the background fx for every foreground fx
import time
from halloweenHead import HalloweenHead
DEBUG = True
SLEEP_TIME = 1
# client
head = HalloweenHead()
def head_menu():
print("what do you want to do?")
print("\tStare [s]")
print("\tRest [r]")
print("\tBlink [b]")
print("\tCrazyBlink [n]")
print("\tScream [c]")
print("\tShortScream [x]")
print("\tLaugh [l]")
print("\tTest Sound [t]")
print("\tQuit [q]")
menu_item = raw_input("\t> ")
if DEBUG: print("menu_item %r" % menu_item)
return menu_item
try:
head.ambiance()
while True:
cmd = head_menu()
if cmd == 'b':
head.blink(2)
if cmd == 'n':
head.crazy_blink(2)
elif cmd == 'r':
head.rest()
elif cmd == 's':
head.stare()
elif cmd == 'l':
head.laugh()
elif cmd == 'c':
head.scream()
elif cmd == 'x':
head.shortscream()
elif cmd == 'd':
head.dance()
elif cmd == 't':
head.testPygame()
elif cmd == 'q':
head.stop_ambiance()
raise KeyboardInterrupt
else:
print("CTRL-C to quit")
time.sleep(SLEEP_TIME * 2)
except KeyboardInterrupt:
head.cleanup()
head.stop_ambiance()