User:Darija Medic/technicalcourse/3rdassignment

From XPUB & Lens-Based wiki
< User:Darija Medic‎ | technicalcourse
Revision as of 20:34, 23 September 2010 by Migratebot (talk | contribs) (Created page with " 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 <source l...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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)


Attachments