-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrampolin.py
executable file
·45 lines (37 loc) · 1.12 KB
/
trampolin.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
#!/usr/bin/env python
import time
import threading
# see https://pypi.python.org/pypi/greenlet as a thread alternative.
TIMEOUT = 1 # in minutes
sec = TIMEOUT * 60
input = ""
inputarray = []
def trampotimer(fieldnum, timeout):
sec = timeout
print "Field %r started" % (fieldnum)
while (sec > 0):
sec -= 1
time.sleep(1)
print "The %r field time is over" % (fieldnum)
def checkfield(fieldnum):
pass
def stop_timer(fieldnum):
pass
def bg_trampotimer(fieldnum, timeout):
trampo_thread = threading.Thread(target=trampotimer, args=(fieldnum, timeout))
trampo_thread.start()
if __name__ == "__main__":
print "Please enter the field to start with the format 'start 1'\nor 'exit' to quit"
while (input != "exit"):
input = raw_input("> ")
inputarray = input.split()
try:
if inputarray[0] == "start":
field = inputarray[1]
#trampotimer(field, sec)
bg_trampotimer(field, sec)
elif inputarray[0] == "status":
print "Status"
except:
continue
print "ByeBye Baby"