[PyQt] Need to draw rotating transparant image... without
david at boddie.org.uk
Tue Jan 8 00:35:36 GMT 2008
On Sun, 30 Dec 2007 15:27:56 -0800 (PST), Wim wrote:
> This is what I would like to do (simplified): I have 2 images (dome.png,
> telescope.png) which are 100x100px, transparant and are meant to be painted
> on top of each other, each rotated under a certain angle. These 2 angles
> can vary with time, and I would like the painting on the screen to be
> updated with these new angles, say at a frequency of once per second.
> My solution (simplified):
> def paintEvent(self, ev):
> p = QPainter()
> bitBlt(self, 0, 0, self.buffer)
> It works, but the problem is that it flickers! The current displayed
> painting is "removed" at the first drawImage, and it takes until the bitBlt
> before it is painted again!
It's been a while since I looked at this kind of problem. Have you tried
experimenting with the updateEnabled property?
You could also try setting the WNoAutoErase flag on the widget:
The (C++) Qt 3 book contains an example of using bitBlt() to avoid flicker,
and there's an old Qt Quarterly article that might be relevant to you - if
you're comfortable with C++, though it should be readable even if you're
More information about the PyQt