[PySide] Keeping GUI responsive

Marian Beermann public at enkore.de
Fri Dec 6 17:45:35 CET 2019


You still get multiple threads, which is still useful. Note that many
operations do unlock the GIL and give you parallelism, for example
performing I/O. So using QThreads in Python to implement parallel I/O or
asynchronous I/O is very much a reasonable thing to do.

It just won't help with speeding up CPU-limited Python code.

-Marian

Am 06.12.19 um 17:33 schrieb Jason H:
> What those links say and what is actually happening here are two different things. 
> 
> It looks like the only way he can do this is to write the thread code in C++, and export that through Shiboken to Python. So the lines:
>     for idx, val in enumerate(self.dataset):
>         self.dataset[idx] = val * 50
> 
> Have to:
> 1) Operate on Qt data (QMap?)
> 2) Have the QRunnable implemented in C++
> 3) Export the class to Python,
> 4) Have Python start the thread
> 
> I find myself asking why QThread exits at all n PySide or at least not have documentation saying that using the class(es) as one would in C++ will not have the same behavior as in C++.


More information about the PySide mailing list