QPicture and Qpainter PyQt4

David Boddie david at boddie.org.uk
Mon Sep 17 08:38:29 EDT 2007


On Mon Sep 17 09:29:43 CEST 2007, luca72 wrote:

> class PictureFrame(QtGui.QFrame):
> 
>   def __init__(self, parent = None):
>     QFrame.__init__(self, parent)
>     picture = QtGui.QPicture()
> 
>   def paintEvent(self, event):
>     picture.load('dis.pic')
>     gr = QtGui.QPainter()
>     gr.begin(self.frame)
>     gr.drawPicture(0, 0, picture)
>     gr.end()
> 
> But nothing is paint.
> Can you give me some help

You should probably be painting on "self" instead of "self.frame".

It may not be related to your problem, but why don't you store the picture in
"self.picture" rather than the local "picture" variable?

David



More information about the Python-list mailing list