[PyQt] Basic thread question
me at the-compiler.org
Fri Sep 29 10:44:35 BST 2017
On Fri, Sep 29, 2017 at 09:24:05AM +0000, Phil wrote:
> On 29/09/17 19:11, Florian Bruhin wrote:
> > You can't do any operations on GUI elements from a secondary thread.
> Thank you for you reply Florian.
> Do you think that you could provide me with a simple example?
> Say I have a thread class like the one shown in my previous message, how do
> I access a MainWindow widget?
You can't, that's my point ;-)
(Well, you *can*, but it's undefined behavior, see
You could do it with a QThread and signals/slots, but I'd really recommend not
using threads at all unless you have a very good reason to do so. There rarely
is such a reason, and the alternatives are much easier and more straightforward.
> > > 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.
> Are saying that QTimer is non blocking?
Almost everything in Qt is, including QTimer.
I found an example here:
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...
Size: 833 bytes
Desc: not available
More information about the PyQt