[PyQt] Basic thread question

Kyle Altendorf sda at fstab.net
Fri Sep 29 14:04:45 BST 2017



On 2017-09-29 07:16, Florian Bruhin wrote:
> On Fri, Sep 29, 2017 at 10:01:57AM +0000, Phil wrote:
>> Now just suppose I need to transmit, or receive, a lot of serial data 
>> using
>> pyserial. The GUI would be blocked during the transmission. Surely 
>> that
>> would be candidate for a thread?
> 
> While you can use PySerial in a thread (as long as you don't directly
> manipulate the GUI from that thread), the easier alternative is 
> probably to use
> Qt's QSerialPort module which does the same kind of thing but 
> non-blocking.

Or Twisted and qt5-reactor.  While I believe Qt has some concurrent 
programming
features beyond just signals and slots, I don't think we get those in 
PyQt5.
Of course, correct me if I'm wrong.  So, Twisted lets you use deferreds 
and the
Python3.5+ (?) async etc keywords to write sequences without having to 
chain
signals and slots.

Cheers,
-kyle


More information about the PyQt mailing list