Guest User

Untitled

a guest
Jul 18th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. # Classe de Sinais.
  2. class Sinais(QtCore.QObject):
  3. # Elementos.
  4. elemento1 = QtCore.Signal()
  5. elemento2 = QtCore.Signal()
  6.  
  7. def __init__(self):
  8. QtCore.QObject.__init__(self)
  9. def emite(self, elemento):
  10. elemento.emit()
  11. sinal = Sinais() # Instância da Classe Sinais.
  12.  
  13.  
  14.  
  15. def a():
  16. print('Bom dia')
  17. def b():
  18. print('Boa Noite')
  19.  
  20. sinal.elemento1.connect(a)
  21. sinal.elemento2.connect(b)
  22.  
  23.  
  24.  
  25. def c():
  26. while True:
  27. time.sleep(1)
  28. sinal.emite(sinal.elemento2)
  29.  
  30. tarefa_c = threading.Thread(target=c)
  31. tarefa_c.daemon = True
  32. tarefa_c.start()
Add Comment
Please, Sign In to add comment