[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Qpainter last question
From:       David Boddie <david () boddie ! org ! uk>
Date:       2007-12-21 0:36:52
Message-ID: 200712210136.53093.david () boddie ! org ! uk
[Download RAW message or body]

On Tue, 18 Dec 2007 10:33:57 +0100, lucaberto wrote:

> In the book is write that repaint force the update of the widget.
>
> so i try this :

[...]

> gra = QtGui.QPainter(self.miaPictureFrame.immagine)
> pen = QtGui.QPen()
> pen.setWidth(1)
> gra.setPen(pen)
> gra.drawText(30, 35, '50 daN/mm')
> self.frame1.repaint()
> sleep(3)
> gra.drawText(395, 30, nome_cal)
> gra.drawText(30, 430, '0')
> self.frame1.repaint()

Are self.frame1 and self.miaPictureFrame the same object?

> my Class is:
>
> class PictureFrame(QtGui.QFrame):
>
>     def __init__(self, parent):
>         QtGui.QFrame.__init__(self, parent)
>         self.setGeometry(QtCore.QRect(0,0, 961, 601))
>         self.immagine = QtGui.QPicture()
>      
>     def paintEvent(self, event):
>         gr = QtGui.QPainter(self)
>         gr.drawPicture(0, 0, self.immagine)          
>
> Nothing is paint can you explain me why?

It's difficult to say without being able to run the code and see what is
happening. It could be that you are asking the wrong object to repaint
itself or there could be another problem that we can't see.

Try putting some print statements in the PictureFrame's paintEvent() method
to make sure that it is being called when you expect. If it is then you will
need to find out why the contents of the picture are not being displayed.
If the paintEvent() method is not being called, you will need to check the
code that makes the repaint requests.

David


_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic