[PyKDE] How do I launch multiple threads?
Barbod Varjavandi
barbod at ada.ca
Sat Mar 17 07:29:04 GMT 2001
How do I launch multiple threads?
I seem to have problem interacting with QT widgets from different Python
threads.
My application starts in C++
Py_Initialize()
PySys_SetArgv(argc, argv);
PyRun_SimpleFile(iPythonScript, PythonScript);
in PythonScript
app = QApplication( sys.argv)
Generate my widgets
sys.stderr = MultiLineText.PyErr
sys.stdout = MultiLineText.PyRes
sys.stdin = MultiLineText.PyInput
app.connect(app, SIGNAL('lastWindowClosed()'), app, SLOT('quit()') );
app.exec_loop()
def write(self,sText):
MultiLineText.insert(sText)
on the click of a button somewhere
thread.start_new_thread(foo, ())
thread.start_new_thread(foo, ())
thread.start_new_thread(foo, ())
def foo():
print "Something"
do something
print "Something"
do something
print "Something"
do something
print "Something"
The program freezes deadlock
Any suggestions?
Barbod
More information about the PyQt
mailing list