<p>Hello,</p>
<p>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.</p>
<p>My solution (simplified):</p>
<p>
<pre>
class Painting(QWidget):
def __init__(self, *args):
self.domeAngle = 0
self.telescopeAngle = 0
apply(QWidget.__init__,(self, ) + args)
self.buffer = QPixmap()
self.setGeometry(0,0,100,100)
self.domeimage = QImage("dome.png")
self.telescopeimage = QImage("telescope.png")
def updateAngles(self,dome=None,telescope=None):
if dome: self.domeAngle = dome
if telescope: self.telescopeAngle = telescope
self.update()
def paintEvent(self, ev):
p = QPainter()
p.begin(self.buffer)
p.translate(50,50)
p.save()
p.rotate(self.telescopeAngle)
p.drawImage(QRect(-205,-205,410,410),self.telescopeimage)
p.restore()
p.save()
p.rotate(self.domeAngle)
p.drawImage(QRect(-205,-205,410,410),self.domeimage)
p.restore()
p.flush()
p.end()
bitBlt(self, 0, 0, self.buffer)
</pre>
</p>
<p>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! I have been trying a lot of other possibilities, but they either give the same result, or strange "xlib" errors. The environment where the code will run forces me to stick to QT3 so I hope it's possible! </p>
<p>If anyone could help me with this I would be very very grateful, thank you very much!</p>
<p>Wim (from Belgium)</p>
<br><hr align="left" width="300">
View this message in context: <a href="http://www.nabble.com/Need-to-draw-rotating-transparant-image...-without-flickering%21-tp14552438p14552438.html">Need to draw rotating transparant image... without flickering!</a><br>
Sent from the <a href="http://www.nabble.com/PyQt-f23444.html">PyQt mailing list archive</a> at Nabble.com.<br>