User:Darija Medic/technicalcourse/3rdassignment
primitive medicine with a primitive edge (first, partial version): cough when you press r (for record) and look at what you could find out about your health
pygame.init()
screen = pygame.display.set_mode((640, 480))
clock = pygame.time.Clock()
tekst = open("zdravljehoroskop.txt")
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT or \
(event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE):
sys.exit()
elif event.type == pygame.KEYDOWN and event.key == pygame.K_r:
system("rec -c 1 ime.wav trim 0 00:00:06")
system("play ime.wav")
#if event.type == pygame.KEYDOWN and event.key == pygame.K_p:
for lines in tekst:
paragraph = lines.strip(' "')
lista = paragraph.split('. ')
for element in lista:
# print element
# print lista.index(element)
broj = random.randint(0, 120)
if broj == lista.index(element):
print element
system("echo '"+element+"' | festival --tts")
pygame.display.update()
clock.tick(30)