[PyKDE] Threads in PyQT

Boudewijn Rempt bsarempt at xs4all.nl
Wed Jul 4 07:16:41 BST 2001


On Tue, 3 Jul 2001, Jason Petrone wrote:

> I'm new to QT, and am trying to figure out how to port a wxPython program
> to PyQT.
> 
> Its a simple app that runs some job in a separate thread.  The thread needs
> to update a QTextView and a QProgressBar, but I can't figure out how to
> post thread safe events.
> 
> If this was C++ QT, I would have the work thread extend QThread so I could
> do this.postEvent().  
> 
> Does the answer have something to do with those mystical SIGNAL/SLOT goblins I
> keep hearing about?
> 

Yes, it is reasonably safe to have the thread emit signals that are caught
by the main thread that runs the interface. You can also have the thread
update a an accessible variable that is read out periodically (use a
QTimer) by the interface thread. 

Hopefully there will appear quite soon an article on using microthreads on
InformIT - it also features a PyQt gui, but you can either use Python
threads or microthreads.





More information about the PyQt mailing list