-
Notifications
You must be signed in to change notification settings - Fork 0
/
learnpy.py
92 lines (86 loc) · 2.17 KB
/
learnpy.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env python
import max7219.led as led
import time
import sys
from max7219.font import proportional, SINCLAIR_FONT, TINY_FONT, CP437_FONT
from random import randrange
device = led.matrix(cascaded=4)
device.orientation(90)
#def Hello(name):
# name = name + '!!!!'
# device.show_message('Hello ' + name)
#def four():
# print ('type "clear" to clear word')
# print ('type "exit" to exit script')
# while(True):
# word = raw_input('Enter 4 letter word: (lowercase) ')
# if(word != 'exit' and word != 'clear'):
# device.letter(0, ord(word[0]))
# device.letter(1, ord(word[1]))
# device.letter(2, ord(word[2]))
# device.letter(3, ord(word[3]))
# time.sleep(0.5)
# elif(word == 'clear'):
# device.clear()
# else:
# print ('Exiting Script')
# device.clear()
# break
def four2():
loop = True
while(loop):
a = []
print ('')
print ('Think Of A Four Letter Word...')
time.sleep(0.5)
a.append(raw_input('Enter First Letter: '))
a.append(raw_input('Enter Second Letter: '))
a.append(raw_input('Enter Third Letter: '))
a.append(raw_input('Enter Forth Letter: '))
if(a[0] == 'e' and a[1] == 'x' and a[2] == 'i' and a[3] == 't'):
print ('Exiting Script')
device.clear()
break
else:
print ('Flashing '+ a[0] + a[1] + a[2] + a[03])
time.sleep(1)
device.letter(0, ord(a[0]))
device.letter(1, ord(a[1]))
device.letter(2, ord(a[2]))
device.letter(3, ord(a[3]))
time.sleep(0.5)
device.clear()
time.sleep(0.5)
device.letter(0, ord(a[0]))
device.letter(1, ord(a[1]))
device.letter(2, ord(a[2]))
device.letter(3, ord(a[3]))
time.sleep(0.5)
device.clear()
time.sleep(0.5)
device.letter(0, ord(a[0]))
device.letter(1, ord(a[1]))
device.letter(2, ord(a[2]))
device.letter(3, ord(a[3]))
time.sleep(0.5)
print ('')
while(True):
again = raw_input('New word? ')
if (again == 'Y'):
device.clear()
break
elif (again == 'N'):
loop = False
print ('Exiting Script')
time.sleep(0.5)
device.clear()
break
else:
print ('Enter Y or N')
time.sleep(0.5)
#Define a main() function that runs when called
#def main():
# Hello(sys.argv[1])
#main()
#four()
four2()