Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- from PyQt4 import QtCore
- class A(QtCore.QObject):
- mySignal = QtCore.pyqtSignal(str)
- def __init__(self):
- QtCore.QObject.__init__(self)
- self.b = B(self)
- self.b.start()
- def some_action(self):
- self.mySignal.emit("Hello World")
- class B(QtCore.QThread):
- def __init__(self, creator):
- QtCore.QThread.__init__(self)
- self._creator = creator
- self._creator.mySignal.connect(self.mySlot)
- def mySlot(self, str):
- print str
- def run(self):
- while True:
- print 'tick'
- time.sleep(1)
- def some_func():
- a = A()
- #a.create_b()
- a.some_action()
- time.sleep(2)
- a.some_action()
- a.some_action()
- some_func()
- time.sleep(3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement