Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Classe de Sinais.
- class Sinais(QtCore.QObject):
- # Elementos.
- elemento1 = QtCore.Signal()
- elemento2 = QtCore.Signal()
- def __init__(self):
- QtCore.QObject.__init__(self)
- def emite(self, elemento):
- elemento.emit()
- sinal = Sinais() # Instância da Classe Sinais.
- def a():
- print('Bom dia')
- def b():
- print('Boa Noite')
- sinal.elemento1.connect(a)
- sinal.elemento2.connect(b)
- def c():
- while True:
- time.sleep(1)
- sinal.emite(sinal.elemento2)
- tarefa_c = threading.Thread(target=c)
- tarefa_c.daemon = True
- tarefa_c.start()
Add Comment
Please, Sign In to add comment