[PyKDE] My thinking still wrong?

Tina Isaksen tina at bestemselv.com
Sat Feb 25 13:08:26 GMT 2006


Andreas Pakulat wrote:

>This time it's actually not python-specific "wrong-thinking" ;-) This
>would've happend to you in C++, Java and any other threaded-language
>with a threaded-toolkit like Qt. You now have 2 Options:
>
>1) Call QApplication::processEvents (IIRC that was the name of the
>function) after setting the text. This makes Qt process any pending
>events (like the redraw of the label) and then returning to your
>code-part, AFAIK.
>
>2) put the "work" into a separate Thread (i.e. the hole
>commands.getoutput which takes time) and communicate between the
>mainTextWindow and the new Thread via Event's. But befor doing so (and
>that is why I'm so brief here) you need to read some basics about
>threading, so you don't shoot yourself in the foot with it (for example
>never trigger drawing-operations outside the gui-thread). I don't have
>any book title or tutorial or some such at hand to recommend, sorry.
>
Ah, I see... thanks! I'm sure I can dig up the required reading. I have 
to admit I was totally oblivious to what you point out, but I can see 
how it makes sense.
As for shooting my self in the foot... I soon have to start fireing at 
the other foot cause the first one must be gone by now ;)

Tina




More information about the PyQt mailing list