[PyQt] QPainter::end: Painter ended with 2 saved states

Hans-Peter Jansen hpj at urpla.net
Fri Jul 1 18:57:43 BST 2011


Hi Eric,

sorry for the delay.

On Tuesday 28 June 2011, 21:42:51 Eric Frederich wrote:
> Here is a reworked example.
> Do you see any potential problems with this one?
> Is the call to setText okay?

Sure, it's done from the main thread, hence in the main thread context.

> Is it okay to access the data member the way I'm doing it in
> print_data?

Hmm, you access Blah.data after your 'SLEPT' loop finished. In this 
special case, it seems save, but it reminded me on one of 
Linus' "special" phrases: "Yes, it's manly, but let's face it, so is 
bungee-jumping with the cord tied to your testicles."

Okay, might be a bit exaggerated for this case..

Anyway, you should turn your code to use new style signals/slots. Raises 
readability and greatly reduces strokes. BTW, I tend to use lambda 
expressions instead of partials, but that's more of a personal 
preference. 

Pete


More information about the PyQt mailing list