Now I have found this:<br><br>self.picture = QtGui.QPicture()<br>self.picture.load("/home/user/grid.jpg")<br><br>And it gives the error:<br><br>QPicturePaintEngine::checkFormat: Incorrect header<br><br>I have tried with a jpg, bmp, svg and an png but all of them return an "incorrect header". What am I doing wrong?<br>
<br>Niels<br><br><div class="gmail_quote">On Wed, Apr 16, 2008 at 9:43 PM, Niels Egberts <<a href="mailto:niels.egberts@gmail.com">niels.egberts@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi, I am pretty new to qt4 and python (have have very limited experience with C++ and qt3).<br><br>I have a QWidget that I am using as a gameboard. So I want to draw svg images on it (like chesspieces and such). I have got this now:<br>
<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"> def __init__(self, parent=None):<br> QtGui.QWidget.__init__(self, parent)<br>
<br> self.setGeometry(300, 300, 250, 150)<br> self.setWindowTitle('Draw Text')<br><br> self.picture = QtGui.QPicture()<br> self.picture.load("images/grid.svg")<br> <br>
<br> def paintEvent(self, event):<br> paint = QtGui.QPainter()<br> paint.begin(self)<br> paint.drawImage(0,0,self.picture)<br> paint.end()<br></blockquote><br>I understand that I need to place my image in a buffer and then do drawImage(0,0,self.buffer) but I can't find out how to do that. Can someone give me a code snippit on how I can achieve to render his svg?<br>
<br>Thank you very much,<br><font color="#888888">Niels<br><br>
</font></blockquote></div><br>