Advertisement
fmasanori

Show Calouros GUI 03

Oct 11th, 2011
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. from tkinter import *
  2. app = Tk()
  3. app.title("Show de calouros")
  4. app.geometry('300x100+200+100')
  5. import pygame.mixer
  6. sounds = pygame.mixer
  7. sounds.init()
  8. certos = 0
  9. errados = 0
  10. def espera_tocar(canal):
  11.     while canal.get_busy():
  12.         pass
  13. def musica_certa():
  14.     global certos
  15.     s = sounds.Sound("correct.wav")
  16.     espera_tocar(s.play())
  17.     certos = certos + 1
  18. def musica_errada():
  19.     global errados
  20.     s = sounds.Sound("wrong.wav")
  21.     espera_tocar(s.play())
  22.     errados = errados + 1
  23. b1 = Button(app, text = "Certo!", width = 10,
  24.             command = musica_certa)
  25. b1.pack(side = "left", padx = 10, pady = 10)
  26. b2 = Button(app, text = "Errado!", width = 10,
  27.             command = musica_errada)
  28. b2.pack (side = "right", padx = 10, pady = 10)
  29. app.mainloop()        
  30.  
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement