*** GMX Spamverdacht *** [Eric] is Eric4 an example of PyQt threading?

Andreas Pakulat apaku at gmx.de
Mon Apr 2 00:38:49 BST 2007


On 01.04.07 16:01:24, Caleb J. Howard wrote:
> I'm trying to find an example anywhere of a python application which uses 
> threading, and PyQt4.  

Well, the PyQt4 examples for threading do use QThread.

> I'd love to see how to do such a thing. 

Look into the examples. All you have to do is create a QThread subclass,
implement the run() method and start an instance of the class.

> A clever friend of mine recently pointed out to me that Eric4 is not 
> only an excellent IDE, but it's also an excellent example of python coding, 
> using many modules.  He said that Eric4 does use threading alongside a PyQt 
> GUI.  Is that true?

Maybe, I never really checked the eric4 source, but a quick grep -r QThread *
shows usage in the VCS-parts of eric4.

> Also, in general, regarding threading and PyQt4...  is there a good reason to 
> use or shun the use of Qt threads?

Well, QThread provides you with an event loop if you need one and I
think its much easier to post events to the gui-thread's event loop from
a QThread than a normal python thread (if the latter is possible at
all). Also using QThread its possible to use signals/slots across
threads, so you can send a signal from the thread to the
main-gui-thread, without the need for a special event.

Andreas 

-- 
You will be traveling and coming into a fortune.


More information about the Eric mailing list