[PyQt] rendering svg

Niels Egberts niels.egberts at gmail.com
Wed Apr 16 20:43:51 BST 2008


Hi, I am pretty new to qt4 and python (have have very limited experience
with C++ and qt3).

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:


    def __init__(self, parent=None):
>         QtGui.QWidget.__init__(self, parent)
>
>         self.setGeometry(300, 300, 250, 150)
>         self.setWindowTitle('Draw Text')
>
>         self.picture = QtGui.QPicture()
>         self.picture.load("images/grid.svg")
>
>
>     def paintEvent(self, event):
>         paint = QtGui.QPainter()
>         paint.begin(self)
>         paint.drawImage(0,0,self.picture)
>         paint.end()
>

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?

Thank you very much,
Niels
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080416/06b86cb1/attachment.html


More information about the PyQt mailing list