Search code examples
python-3.xmultithreadingpyqt5joblibpython-windows-bundle

widely used multi-thread or concurrent processing for pyqt5?


My question is about the usage of thread in the pyqt5 application. I am fair newly to the GUI world, I am an embedded guy. I m having a hard time bundling my python3 application in Windows that uses Joblib to achieve parallelism. I am doing read and write of 10 UARTs concurrently.

I want to deliver this application as Windows OS installation to the customer, not as code in the factory.

I am planning to abandon the usage of Joblib in my pyqt5 application because of creating windows package.

I checked with other GUI guy at my work, he said pyqt5 threads have a lot of issues and synchronizing threads are big mess, not that easy, but his answer is not convincing to me.

I am sure in this world many using Pyqt5 build in multi-thread or multi-parallel mechanism, I just want to write parallelly to the Uarts and read the data from Uarts stream.

Someone can provide the good source to learn more about pyqt5 multithread or parallel processing example?


Solution

  • I am not a python expert, however as PyQt5 is a library with Qt5 bindings I would not use threads for achieving what you want.

    Qt provides very convenient mechanism of signals. You can write data to all your UARTs and then wait for signals telling you can read data (assuming you are going to use QSerialPort class).

    This would of course work in one thread, but as long as you don't need super speed or read/write tons of data, you may find it suitable.