PySide6.QtCore.QThreadPool().start() (only one signature)

Heads up! You've already completed this tutorial.

PedanticHacker | 2021-07-24 11:47:19 UTC | #1

In PyQt6, there are two signatures for the start() method of QThreadPool():

  1. PyQt6.QtCore.QThreadPool().start(QRunnable, priority: int = 0)
  2. PyQt6.QtCore.QThreadPool().start(Callable[[], None], priority: int = 0)

In PyQt6, you don't need a runnable, just simply pass a callable (a Python function/method) to the start() method (that is some sort of a long-running task) and be done with it.

The second signature of the start() method of QThreadPool() in PyQt6 (listed above) is the only thing that is keeping me away from PySide6, because PySide6 only has one signature for the start() method (only the first signature, listed above).

@martin, will PySide6 ever provide the second signature for the start() method, so that we won't be forced to create a runnable, but we would be able to simply pass a callable to it?

I wrote to the PySide mailing list asking this same question, but got no response after waiting more than a month. Are you in contact with any of the PySide devs?


martin | 2022-08-09 11:15:14 UTC | #3

QThreadPool.start(<function>) is now available in PySide6 as well as PyQt6 & PyQt5. There's a demo tutorial here showing the usage.


Over 10,000 developers have bought Create GUI Applications with Python & Qt!
Create GUI Applications with Python & Qt6
Take a look

Downloadable ebook (PDF, ePub) & Complete Source code

Also available from Payhip , Gumroad , Leanpub and Amazon Paperback

[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]

Purchasing Power Parity

Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

PySide6.QtCore.QThreadPool().start() (only one signature) was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.