Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt4 import QtGui, QtCore
- import sys, time
- thd, thd2 = None, None
- class T(QtCore.QThread):
- def __init__(self, f):
- super().__init__()
- self.f = f
- def run(self):
- print("running", self.f)
- self.f()
- def thd_fin():
- print("Fin.")
- def thd_fin3():
- print("Fin3.")
- def threadInThread():
- global thd2
- thd2 = T(lambda: None)
- thd2.finished.connect(thd_fin3)
- thd2.start()
- time.sleep(2)
- class Form(QtGui.QWidget):
- def __init__(self):
- super().__init__()
- global thd
- thd = T(threadInThread)
- thd.finished.connect(thd_fin)
- thd.start()
- app = QtGui.QApplication(sys.argv)
- f = Form()
- f.show()
- app.exec()
Advertisement
Add Comment
Please, Sign In to add comment