[PyQt] Basic thread question

Florian Bruhin me at the-compiler.org
Fri Sep 29 10:11:23 BST 2017


Hi,

On Fri, Sep 29, 2017 at 09:03:17AM +0000, Phil wrote:
> What I'd like to do is sweep the dial back and forth and to do this I can
> see that I need a thread so that I don't block the GUI. My question is,
> where do I place the thread class? If I place it in the same file after the
> MainWindow class, how do I then access the dial? I don't think the thread
> class is added to main_script.py. At the moment, I cannot see how to access
> the dial from there anyway.

You can't do any operations on GUI elements from a secondary thread.

> I know that this is not totally correct, but just say that I wanted to step
> the dial point along at a one second rate. How should I proceed?

The proper way to do this would be using a QTimer.

Florian

-- 
https://www.qutebrowser.org  | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072  | https://the-compiler.org/pubkey.asc
         I love long mails!  | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170929/e6a73a7c/attachment.sig>


More information about the PyQt mailing list