[PyQt] Calling slots in a QThread?
Lukas Hetzenecker
LuHe at gmx.at
Wed Aug 12 23:15:13 BST 2009
But If I call long-running funtions in a run() method everything works as
expected.
I want to call such functions also from outside (using a signal-slot-
connection from another thread).
Am Mittwoch 12 August 2009 20:26:38 schrieb Arnold Krille:
> Hi,
>
> On Wednesday 12 August 2009 19:04:46 Lukas Hetzenecker wrote:
> > is it possible to connect signals from a Widget to a slot in a QThread
> > and ensure that the Widget responds to keypress and mouse events?
> > I attached my first try, but it doesn't work, the UI blocks until the
> > execution of the function is finished.
>
> Without looking at the code: This is not a problem with Qt but with python.
> The keyword is GIL, the global interpreter lock which ensures that only one
> thread is executing python in this runtime instance.
>
> There are two ways to have "true" threads:
> 1) Implement the thread in C++ and bridge it to python with SIP the same
> way Qt is bridged to python.
I want to use python modules in the thread so I don't think that this would
work.
> 2) Use processes instead of threads. Then you can run several instances of
> the python interpreter at the same time.
This seems too complicated for this simple task.
> Arnold
More information about the PyQt
mailing list