[PyQt] Threads with PyQt. Qt's or Python's?
Sergio Jovani
lesergi at gmail.com
Mon Jan 19 15:45:27 GMT 2009
Hi,
I always used QThread and emit() in order to communicate with main
QThread without problems:
thread = Thread(self)
self.connet(thread, SIGNAL("Signal"))
thread.start()
2009/1/19 Christoph Burgmer <chrislb at gmx.de>:
> Am Monday, 19. January 2009 schrieb Giovanni Bajo:
>
>> On 1/19/2009 3:13 PM, eliben wrote:
>
>> > I've seen various references to this issue before, but nothing to fully
>
>> > address it as I'd expect.
>
>> >
>
>> > Can you comment on the pros and cons of using QThread vs Python's
>> > threads
>
>> > with PyQt?
>
>> >
>
>> > I'll begin: on the surface, Python's threads make more sense because
>
>> > they're Qt independent and can be ported between apps that don't
>
>> > necessarily depend on Qt (for example a web version of a GUI app). The
>
>> > Python thread API is powerful enough for all uses, it seems.
>
>> >
>
>> > However, there are concerns. Perhaps QThreads are more efficient? Or
>
>> > maybe more tightly integrated with the other parts of PyQt, so it's
>
>> > easier to use them?
>
>>
>
>> It's mostly the same. The main difference is that QThreads are better
>
>> integrated with Qt (asynchrnous signals/slots, event loop, etc.). Also,
>
>> you can't use Qt from a Python thread (you can't for instance post event
>
>> to the main thread through QApplication.postEvent): you need a QThread
>
>> for that to work.
>
> I am doing a
>
> QCoreApplication.postEvent()
>
> out of "run()" from a "threading.Thread" class without any problems.
>
> Christoph
>
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
More information about the PyQt
mailing list