Hans-Peter Jansen
Tue, 06 May 2008 01:05:46 -0700
Am Dienstag, 6. Mai 2008 schrieb tsic:
> Hello,
> I tried to program a chat interface between a server and many clients.
> when I used Qthread this message apear when I execute my program file
> from DOS:
Has anybody ported PyQt to DOS without my knowledge? ;-)
> QThread: Destroyed while thread is still running
> And stop the execution of the program because pythonw.exe has find a
> problem and must close...
> this is my code
>
> def conec(self):
> HOST = self.adripes.text()
> PORT = int(self.nipes.text())
> thread = Thread(HOST, PORT)
> QtCore.QObject.connect(thread, SIGNAL("finished()"),thread,
> SLOT("deleteLater()"))
> thread.start()
...and the thread disappears, when this method finish.
This is by far the most frequent PyQt beginners failure:
You either need to keep a reference on the thread object
(e.g.: s/thread/self.thread/)
or add a parent object to the ctor, as most Qt objects do.
How to do the latter is left as an exercise to the implementor.
Pete
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt